Description
I created an ONNX sample file having output shape Nx100.
When I parsed the ONNX with trtexec I got (-1,-1) for output shape. Why not (-1, 100)?
Please help.
Environment
TensorRT Version: 7.0.0.11
GPU Type: Quadro P1000
Nvidia Driver Version: 441.22
CUDA Version: 10.2.89
CUDNN Version: 7.6.5.32
Operating System + Version: Windows 10 Enterprise 64bit
Python Version (if applicable): 3.6.7
TensorFlow Version (if applicable): 1.13.1
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):
Steps To Reproduce
model = tf.keras.models.Sequential([tf.keras.layers.InputLayer(name=‘input’,input_shape=(32,32,3)),
tf.keras.layers.Conv2D(16, (3,3), activation=‘relu’),
tf.keras.layers.MaxPool2D(),
tf.keras.layers.Conv2D(32, (3,3), activation=‘relu’),
tf.keras.layers.MaxPool2D(),
tf.keras.layers.Conv2D(64, (3,3), activation=‘relu’),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(1000, activation=‘relu’),
tf.keras.layers.Dense(100, activation=‘softmax’, name=‘output’)])
model.summary()
Layer (type) Output Shape Param #
conv2d (Conv2D) (None, 30, 30, 16) 448
max_pooling2d (MaxPooling2D) (None, 15, 15, 16) 0
conv2d_1 (Conv2D) (None, 13, 13, 32) 4640
max_pooling2d_1 (MaxPooling2 (None, 6, 6, 32) 0
conv2d_2 (Conv2D) (None, 4, 4, 64) 18496
flatten (Flatten) (None, 1024) 0
dense (Dense) (None, 1000) 1025000
output (Dense) (None, 100) 100100
=================================================================
Total params: 1,148,684
Trainable params: 1,148,684
Non-trainable params: 0
trtexec --verbose --explicitBatch --workspace=128 --onnx=cifar100.onnx
output:
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:123: Searching for input: output/bias:0
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:129: Add [Add] inputs: [transformed_tensor → (-1, 100)], [output/bias:0 → (100)],
[03/31/2020-17:14:05] [V] [TRT] ImporterContext.hpp:122: Registering layer: Add for ONNX node: Add
[03/31/2020-17:14:05] [V] [TRT] ImporterContext.hpp:97: Registering tensor: biased_tensor_name for ONNX tensor: biased_tensor_name
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:180: Add [Add] outputs: [biased_tensor_name → (-1, 100)],
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:107: Parsing node: Softmax [Softmax]
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:123: Searching for input: biased_tensor_name
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:129: Softmax [Softmax] inputs: [biased_tensor_name → (-1, 100)],
[03/31/2020-17:14:05] [W] [TRT] onnx2trt_utils.cpp:198: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[03/31/2020-17:14:05] [W] [TRT] onnx2trt_utils.cpp:198: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[03/31/2020-17:14:05] [V] [TRT] ImporterContext.hpp:122: Registering layer: Softmax for ONNX node: Softmax
[03/31/2020-17:14:05] [V] [TRT] ImporterContext.hpp:97: Registering tensor: output/Softmax:01 for ONNX tensor: output/Softmax:01
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:180: Softmax [Softmax] outputs: [output/Softmax:01 → (-1, -1)],
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:107: Parsing node: Identity5 [Identity]
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:123: Searching for input: output/Softmax:01
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:129: Identity5 [Identity] inputs: [output/Softmax:01 → (-1, -1)],
[03/31/2020-17:14:05] [V] [TRT] ImporterContext.hpp:122: Registering layer: Identity5 for ONNX node: Identity5
[03/31/2020-17:14:05] [V] [TRT] ImporterContext.hpp:97: Registering tensor: output_1 for ONNX tensor: output
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:180: Identity5 [Identity] outputs: [output → (-1, -1)],
[03/31/2020-17:14:05] [V] [TRT] ModelImporter.cpp:494: Marking output_1 as output: output
----- Parsing of ONNX model cifar100.onnx is Done ----