Counting weight in kernel mismatch with input channel

Description

A clear and concise description of the bug or issue.

Environment

TensorRT Version: 7
GPU Type: 1070
Nvidia Driver Version:
CUDA Version: 10.0
CUDNN Version: 7.6
Operating System + Version: ubuntu16
Python Version (if applicable): 3.6
TensorFlow Version (if applicable): 1.13.2

Hello NV team,

I am using UFFparser to generate engine. The current situation is I trained my model with NCHW data format, and set the register_input as NCHW. but I still got this bug. Do u have any idea> please, thanks.

  conv = slim.conv2d(p_x, num_out_layers, kernel_size, 1, 'VALID', activation_fn=tf.nn.elu, normalizer_fn=None, data_format = "NCHW")

[TensorRT] VERBOSE: UFFParser: model/decoder/Pad -> [1024,24,76]
[TensorRT] VERBOSE: UFFParser: Applying order forwarding to: model/decoder/Pad
[TensorRT] VERBOSE: UFFParser: Parsing model/decoder/transpose[Op: Transpose]. Inputs: model/decoder/Pad
[TensorRT] VERBOSE: UFFParser: model/decoder/transpose -> [1024,24,76]
[TensorRT] VERBOSE: UFFParser: Applying order forwarding to: model/decoder/transpose
[TensorRT] VERBOSE: UFFParser: Parsing model/decoder/Conv/weights[Op: Const].
[TensorRT] VERBOSE: UFFParser: model/decoder/Conv/weights -> [3,3,1024,256]
[TensorRT] VERBOSE: UFFParser: Applying order forwarding to: model/decoder/Conv/weights
[TensorRT] VERBOSE: UFFParser: Parsing model/decoder/Conv/Conv2D[Op: Conv]. Inputs: model/decoder/transpose, model/decoder/Conv/weights
[TensorRT] VERBOSE: UFFParser: Inserting transposes for model/decoder/Conv/Conv2D
[TensorRT] VERBOSE: Bias weights are not set yet. Bias weights can be set using setInput(2, bias_tensor) API call.
[TensorRT] ERROR: model/decoder/Conv/Conv2D: kernel weights has count 2359296 but 175104 was expected
[TensorRT] ERROR: model/decoder/Conv/Conv2D: count of 2359296 weights in kernel, but kernel dimensions (3,3) with 76 input channels, 256 output channels and 1 groups were specified. Expected Weights count is 76 * 33 * 256 / 1 = 175104
[TensorRT] VERBOSE: UFFParser: model/decoder/Conv/Conv2D -> []
[TensorRT] VERBOSE: UFFParser: Applying order forwarding to: model/decoder/Conv/Conv2D
[TensorRT] VERBOSE: UFFParser: Parsing model/decoder/Conv/biases[Op: Const].
[TensorRT] ERROR: model/decoder/Conv/Conv2D: kernel weights has count 2359296 but 175104 was expected
[TensorRT] ERROR: model/decoder/Conv/Conv2D: count of 2359296 weights in kernel, but kernel dimensions (3,3) with 76 input channels, 256 output channels and 1 groups were specified. Expected Weights count is 76 * 3
3 * 256 / 1 = 175104
[TensorRT] VERBOSE: UFFParser: model/decoder/Conv/biases ->
[TensorRT] VERBOSE: UFFParser: Applying order forwarding to: model/decoder/Conv/biases
[TensorRT] VERBOSE: UFFParser: Parsing model/decoder/Conv/BiasAdd[Op: Binary]. Inputs: model/decoder/Conv/Conv2D, model/decoder/Conv/biases
[TensorRT] ERROR: model/decoder/Conv/Conv2D: kernel weights has count 2359296 but 175104 was expected
[TensorRT] ERROR: model/decoder/Conv/Conv2D: count of 2359296 weights in kernel, but kernel dimensions (3,3) with 76 input channels, 256 output channels and 1 groups were specified. Expected Weights count is 76 * 3*3 * 256 / 1 = 175104
[TensorRT] ERROR: UffParser: Parser error: model/decoder/Conv/BiasAdd: The input to the Scale Layer is required to have a minimum of 3 dimensions.

Hi,

We are deprecating Caffe Parser and UFF Parser in TensorRT 7. Please refer below link for more details:
https://docs.nvidia.com/deeplearning/sdk/tensorrt-archived/tensorrt-700/tensorrt-release-notes/tensorrt-7.html#rel_7-0-0

I will recommend you to try tf2ONNX and ONNX parser for TRT engine generation. Please refer below link:


Thanks