TensorRT6.0 PReLU Bug Report

[11/19/2019-16:25:28] [V] [TRT] 405:Conv -> (64, 112, 112)
[11/19/2019-16:25:28] [E] [TRT] (Unnamed Layer* 6) [Parametric ReLU]: slope tensor must be unidirectional broadcastable to input tensor
[11/19/2019-16:25:28] [V] [TRT] 406:PRelu -> (0)

prelu output a wrong tensor with 0 dim

Hi,

Could you share a simple reproducible source with us?
We want to check in further and feedback to our internal team.

Thanks.

Envs: Jetpack4.3 Tx2
The bug occurs when I turn trt from onnx,onnx grahp as below:

graph(%0 : Float(1, 3, 112, 112)
      %1 : Float(64, 3, 3, 3)
      %2 : Float(64)
      %3 : Float(64)
      %4 : Float(64)
      %5 : Float(64)
      %6 : Long()
      %7 : Float(64)) {
  %8 : Float(1, 64, 56, 56) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2]](%0, %1), scope: AirFace/Conv_block[conv1]/Conv2d[conv]
  %9 : Float(1, 64, 56, 56) = onnx::BatchNormalization[epsilon=1e-05, momentum=1](%8, %2, %3, %4, %5), scope: AirFace/Conv_block[conv1]/BatchNorm2d[bn]
  %10 : Float(1, 64, 56, 56) = onnx::PRelu(%9, %7), scope: AirFace/Conv_block[conv1]/PReLU[prelu]
  return (%10);
}

from onnx to trt using the codes:

cd /usr/src/tensorrt/bin
./trtexec --onnx=/home/ubuntu/temp_onnx/face_partial_upload.onnx --saveEngine=/home/ubuntu/temp_onnx/face_partial_upload.trt --fp16 --batch=3 --verbose

the trtexec output is:


[11/20/2019-14:48:42] [V] [TRT] /home/jenkins/workspace/TensorRT/helpers/rel-6.0/L1_Nightly/build/source/parsers/onnxOpenSource/builtin_op_importers.cpp:773: Convolution input dimensions: (3, 112, 112)
[11/20/2019-14:48:42] [V] [TRT] /home/jenkins/workspace/TensorRT/helpers/rel-6.0/L1_Nightly/build/source/parsers/onnxOpenSource/builtin_op_importers.cpp:840: Using kernel: (3, 3), strides: (2, 2), padding: (1, 1), dilations: (1, 1), numOutputs: 64
[11/20/2019-14:48:42] [V] [TRT] /home/jenkins/workspace/TensorRT/helpers/rel-6.0/L1_Nightly/build/source/parsers/onnxOpenSource/builtin_op_importers.cpp:841: Convolution output dimensions: (64, 56, 56)
[11/20/2019-14:48:42] [V] [TRT] 15:Conv -> (64, 56, 56)
[11/20/2019-14:48:42] [V] [TRT] 16:BatchNormalization -> (64, 56, 56)
[11/20/2019-14:48:42] [E] [TRT] (Unnamed Layer* 3) [Parametric ReLU]: slope tensor must be unidirectional broadcastable to input tensor
[11/20/2019-14:48:42] [V] [TRT] 17:PRelu -> (0)
[11/20/2019-14:48:42] [V] [TRT] /home/jenkins/workspace/TensorRT/helpers/rel-6.0/L1_Nightly/build/source/parsers/onnxOpenSource/builtin_op_importers.cpp:773: Convolution input dimensions: 
While parsing node number 3 [Conv -> "18"]:

i’m pretty sure thers is no thing in onnx between batchnorm and prelu layer.
More detail on github:https://github.com/BokyLiu/Jetpack4.3-Trt6-PReLU-bug-report/tree/master

Hi,

It looks like you are meeting the same problem of this topic:
https://devtalk.nvidia.com/default/topic/1066471/tensorrt-6-0-1-parametric-relu-/

Could you check if the suggestion helps first?
Thanks.

not helpful.

Hi,

Thanks for your patience.

This issue is passed to our internal TensorRT team.
Will update more information with you once we got any feedback.

Hello,

We got some feedback from our internal TensorRT team.

This issue looks like to be a bug inside the model.
Based on the ONNX spec for PReLU: https://github.com/onnx/onnx/blob/master/docs/Operators.md#PRelu
The slope tensor should be unidirectionally broadcastable to the input tensor.

In your graph, the input shape is [64, 56, 56] but the slope shape is [64].
The correct shape for the Prelu slope should be [64,1,1]

Could you update the slopes into [64,1,1] and try it again?
Thanks and please let us know the result.

Hi, thank you for your team.
Did you mean update slopes shape in my onnx model?

YES.

%7 : Float(64)) {