Unsupported operation 'if' in Tensorrt 7.0.0


I made made a custom model and converted it to ONNX.
It uses ‘if’ operation and ‘reverse sequence’ operation which are unsupported in TensorRT 7.0.0

But ‘if’ operation is supported in TensorRT 7.1.0.
So, may I when Nvidia will be releasing 7.1.0 OSS becuase then I’ll just have to implement ‘reverse sequence layer’ or if there is another way to implement layer without TRT source code. please share.

trtexec Logs:
log.txt (137.2 KB)


TensorRT Version: 7.1.0/7.0.0
CUDA Version: 10.2
Operating System + Version: Jetpack 4.4 DP

Hello @pickleRick,
TensorRT 7.1.0 does not support ‘if’ and ‘reverseSequence’ operation. You can find the list of supported operators in the link below-
However if you wish to implement reverse sequence layer, you may use a custom plugin for the same.
Please find the link for reference.


Then why I’m not getting ‘if’ operation error when using TRT 7.1.0 and getting it when I’m using 7.0.0?

Did you add parser of ‘if’ in ONNX parser in 7.1.0?

‘If’ operator is not supported in Onnx parser in R7.1.0.

Can you please help us with your model and verbose logs so that we can assist you better.

I’ve attached the logs below.

logs_7.0.0_OSS.txt (45.9 KB)

logs_7.1.0.txt (84.1 KB)

Onnx model file

This issue is solved now.

If operations were added because we used keras api in TF to build the model and tf2onnx to convert to onnx. Instead, we should have used keras2onnx.

Using keras2onnx solves this problem. but still doesn’t explain why we don’t get any unsupported op ‘if’ when using 7.1.0?

Now I’m getting a different error.

[8] Assertion failed: std::equal(activationAlphas.begin(), activationAlphas.begin() + NUM_ACTIVATIONS, activationAlphas.begin() + NUM_ACTIVATIONS) && "The parser does not currently support cases where activations for the reverse pass of the LSTM do not match the forward pass."

I think I’ll start a different topic for this issue.

This is especially true when games are very large or complex, and have a long list of possible situations. Even in 30K hours, the testers couldn’t test every single possibility in the game. Did they test what happens if a car explodes while upside down on a rock at night in the rain while the player is in the middle of the bike-mounting animation? Did they test what happens if you’re in the middle of reloading a gun when a building collapses in mission 17 when your hand is supposed to cover your face, resulting in a weird animation glitch? Did they accelerate to mass speed while manipulating the camera with the mouse on its highest sensitivity but the aiming inverted? There are some bugs that only happen if you did one thing in one part of the game and another in a separate part 10 hours later – if they were testing chunk by chunk (the usual situation), maybe they never saw that combination. word counter