Note: Same issue has been reported via bug reporting in https://developer.nvidia.com with bug id #2460798.
[Platform details]
Linux distro and version: Ubuntu 16.04.5 LTS
GPU type: GeForce GTX 1080 Ti
nvidia driver version: 410.72
CUDA version: 9.0.176
CUDNN version: 7.3.1.20
Python version [if using python]: 3.5.2
Tensorflow version: 1.11.0
TensorRT version: debian packages with 5.0.2-1+cuda9.0
in nv-tensorrt-repo-ubuntu1604-cuda9.0-trt5.0.2.6-ga-20181009_1-1_amd64
import tensorflow as tf
import tensorrt as trt
import uff
TRT_LOGGER = trt.Logger(trt.Logger.Severity.INFO)
graph = tf.Graph()
with graph.as_default():
input_tensor = tf.placeholder(tf.float32, [1, 300, 4], name='input')
# [1, 300, 4] -> [300, 4]
reshaped = tf.reshape(input_tensor, [-1, 4], name='output')
UFF_PATH = '/tmp/test_reshape.uff'
serialized_uff = uff.from_tensorflow(output_filename=UFF_PATH,
output_nodes=['output'],
quiet=False,
text=False,
graphdef=graph.as_graph_def())
with trt.Builder(TRT_LOGGER) as builder:
with builder.create_network() as network:
uff_parser = trt.UffParser()
uff_parser.register_input('input', [300, 4])
uff_parser.register_output('output')
uff_parser.parse(UFF_PATH, network)
# Parsing fails with the following error message
# [TensorRT] ERROR: UFFParser: Parser error: output: Reshape: Volume mismatch
import tensorflow as tf
import tensorrt as trt
import uff
TRT_LOGGER = trt.Logger(trt.Logger.Severity.INFO)
graph = tf.Graph()
with graph.as_default():
input_tensor = tf.placeholder(tf.float32, [1, 300, 4], name='input')
# [1, 300, 4] -> [1, 300, 4]
reshaped = tf.reshape(input_tensor, [1, -1, 4], name='output')
UFF_PATH = '/tmp/test_reshape.uff'
serialized_uff = uff.from_tensorflow(output_filename=UFF_PATH,
output_nodes=['output'],
quiet=False,
text=False,
graphdef=graph.as_graph_def())
with trt.Builder(TRT_LOGGER) as builder:
with builder.create_network() as network:
uff_parser = trt.UffParser()
uff_parser.register_input('input', [300, 4])
uff_parser.register_output('output')
uff_parser.parse(UFF_PATH, network)
output_tensor = network.get_output(0)
print('Output: name {}, shape {}'.format(output_tensor.name, output_tensor.shape))
# Expected shape: [1, 300, 4], returned shape: [300, 4, 1]