You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first, I download resnet_v2_fp32_savedmodel_NHWC_jpg saved_model from blog
then, I run a example provided in nvidia documents about trt-tf here :
# Import TensorFlow and TensorRT
import tensorflow as tf
import tensorflow.contrib.tensorrt as trt
# Inference with TF-TRT `SavedModel` workflow:
graph = tf.Graph()
with graph.as_default():
with tf.Session() as sess:
# Create a TensorRT inference graph from a SavedModel:
trt_graph = trt.create_inference_graph(
input_graph_def=None,
outputs=None,
input_saved_model_dir="/tmp/resnet/1538687457",
input_saved_model_tags=["serve"])
# Import the TensorRT graph into a new graph and run:
output_node = tf.import_graph_def(
trt_graph,
return_elements=["softmax_tensor"])
sess.run(output_node)
but it shows error:
2019-03-19 17:21:53.332397: I tensorflow/contrib/tensorrt/convert/convert_graph.cc:913] Number of TensorRT candidate segments: 1
2019-03-19 17:21:54.040844: W tensorflow/contrib/tensorrt/convert/convert_nodes.cc:3710] Validation failed for TensorRTInputPH_0 and input slot 0: Input tensor with shape [?,?,?,3] has an unknown non-batch dimension at dim 1
2019-03-19 17:21:54.040922: W tensorflow/contrib/tensorrt/convert/convert_graph.cc:1021] TensorRT node TRTEngineOp_0 added for segment 0 consisting of 445 nodes failed: Invalid argument: Validation failed for TensorRTInputPH_0 and input slot 0: Input tensor with shape [?,?,?,3] has an unknown non-batch dimension at dim 1. Fallback to TF...
2019-03-19 17:21:54.289076: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:581] Optimization results for grappler item: tf_graph
2019-03-19 17:21:54.289142: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:583] constant folding: Graph size after: 550 nodes (-256), 613 edges (-258), time = 820.515ms.
2019-03-19 17:21:54.289160: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:583] layout: Graph size after: 557 nodes (7), 615 edges (2), time = 142.796ms.
2019-03-19 17:21:54.289171: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:583] constant folding: Graph size after: 552 nodes (-5), 615 edges (0), time = 535.989ms.
2019-03-19 17:21:54.289184: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:583] TensorRTOptimizer: Graph size after: 552 nodes (0), 615 edges (0), time = 1296.37695ms.
2019-03-19 17:22:03.134267: I tensorflow/stream_executor/dso_loader.cc:152] successfully opened CUDA library libcublas.so.10.0 locally
Traceback (most recent call last):
File "trt-tf.py", line 18, in <module>
sess.run(output_node)
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'import/input_tensor' with dtype string and shape [?]
[[node import/input_tensor (defined at trt-tf.py:17) ]]
[[node import/map/Shape (defined at trt-tf.py:17) ]]
Caused by op u'import/input_tensor', defined at:
File "trt-tf.py", line 17, in <module>
return_elements=["softmax_tensor"])
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/framework/importer.py", line 442, in import_graph_def
_ProcessNewOps(graph)
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/framework/importer.py", line 235, in _ProcessNewOps
for new_op in graph._add_new_tf_operations(compute_devices=False): # pylint: disable=protected-access
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3433, in _add_new_tf_operations
for c_op in c_api_util.new_tf_operations(self)
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3325, in _create_op_from_tf_operation
ret = Operation(c_op, self)
File "/xxx/.virtualenvs/tf-tmp/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1801, in __init__
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'import/input_tensor' with dtype string and shape [?]
[[node import/input_tensor (defined at trt-tf.py:17) ]]
[[node import/map/Shape (defined at trt-tf.py:17) ]]
how to fix it? anyone can give some advises?
my envs:
tensorflow-gpu 1.13.1
The text was updated successfully, but these errors were encountered:
first, I download
resnet_v2_fp32_savedmodel_NHWC_jpg
saved_model from blogthen, I run a example provided in nvidia documents about trt-tf here :
but it shows error:
how to fix it? anyone can give some advises?
my envs:
tensorflow-gpu 1.13.1
The text was updated successfully, but these errors were encountered: