Platform details:
Linux distro and version: Ubuntu 16.04.5 LTS
GPU type: GeForce GTX 1080 Ti
nvidia driver version: 410.78
CUDA version: 9.0.176
CUDNN version: 7.5.0.56
Python version [if using python]: 3.5.2
Tensorflow version: 1.11.0
TensorRT version: 5.1.2
import numpy as np
import tensorflow as tf
import tensorrt as trt
import uff
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
TRT_LOGGER = trt.Logger(trt.Logger.Severity.INFO)
INPUT_DIMENSIONS = [3, 2, 3]
graph = tf.Graph()
with graph.as_default():
input_tensor = tf.placeholder(tf.float32, INPUT_DIMENSIONS, name='input')
sliced = input_tensor[:,:,0:2]
print('sliced tensor shape: {}'.format(sliced.shape))
with tf.Session() as sess:
input = np.array([[[1, 2, 3], [4, 5, 6]],
[[7, 8, 9], [10, 11, 12]],
[[5, 5, 5], [6, 6, 6]]])
sliced_np = sess.run(sliced, {input_tensor: input})
print('sliced numpy shape: {}'.format(sliced_np.shape))
UFF_PATH = '/tmp/test_strided_slice.uff'
serialized_uff = uff.from_tensorflow(output_filename=UFF_PATH,
output_nodes=['strided_slice'],
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', INPUT_DIMENSIONS)
uff_parser.register_output('strided_slice')
uff_parser.parse(UFF_PATH, network)
output_tensor = network.get_output(0)
print('Output: name {}, shape {}'.format(output_tensor.name, output_tensor.shape))
outputs:
[TensorRT] ERROR: UffParser: Parser error: strided_slice: mismatch between begin_mask/end_mask and begin/end