Description
I’m trying to convert Keras model into Tensorrt Engine (Keras → ONNX → Engine).
Model contains tf.gather
with batch_dims
set to non-zero.
# I want to take
# batch_size x N
params = tf.constant([['b11', 'b12', 'b13'], ['b21', 'b22', 'b23']])
# batch_size x N
indices = tf.constant([[0, 1], [1, 2]])
# collect relevant param per batch
tf.gather(params, indices, batch_dims=1)
[['b11', 'b12'], ['b22', 'b23']]
I’m able to convert model to ONNX format with opset
version = 12. As it mentioned here: onnx/Changelog.md at main · onnx/onnx · GitHub.
And a bit confused by naming. Why tf.gather
corresponds to GatherND
op in ONNX graph? For example, GatherElements satisfies my need, but how to set it instead GatherND
?
But, I can’t convert ONNX model to Engine. With the following error
No importer registered for op: GatherND. Attempting to import as plugin
As I got from here it is not supported by onnx-tensorrt: onnx-tensorrt/operators.md at 7.2.1 · onnx/onnx-tensorrt · GitHub ? If it is not implemented, what is the best way to solve issue? Maybe replace with similar node if exists? Or just cut this part of graph and do post-processing?
I’d be grateful for any advice :)
Environment
TensorRT Version: 7.2.1.6
GPU Type: 1050
Nvidia Driver Version: 470.63.01
CUDA Version: 11.4
Operating System + Version: 18.04
Python Version (if applicable): 3.6.9
TensorFlow Version (if applicable): 1.15.5
ONNX: 1.7.0
Baremetal or Container (if container which image + tag): nvcr.io/nvidia/tensorrt:20.11-py3