Software version: TensorRT 5.0.4 or TensorRT 5.1.2rc (same behavior on both)
Problem summary: Axis parameter conversion is “off by one” in UFF conversion of tf.gather from Tensorflow (uff.from_tensorflow_frozen_model)
- according to TensorRT docuementation of the IGatherLayer, “the parameter axis is zero-indexed and starts at the first non-batch dimension of data tensor”
- however for the Tensorflow function tf.gather, the axis parameter starts with the first dimension (including batch)
- thus the UFF converter should subtract 1 from the provided axis parameter when setting the axis parameter of the IGatherLayer. However it does not.
- I have confirmed this because running the UFF converter and executing in TensorRT the following does not generate the correct results:
data = tf.zeros([10, 2, 5])
g1 = tf.gather(data, 0, axis=1)
however decrementing the axis and running under TensorRT then generates the correct result
g1 = tf.gather(data, 0, axis=0)
even though according to (1) above, TensorRT is not capable of gathering over the batch dimension (thus the converter should have reported an error because I used axis=0 above)