我正在尝试使用'tensorflow.contrib.tensorrt'中的python API'create_inference_graph'将TensorFlow图转换为TensorRT推理图,并且出现了这些警告。
W tensorflow/contrib/tensorrt/convert/convert_graph.cc:794] Failed to register segment graphdef as a function 1: Invalid argument: Node 'polymath1_model_Polymath1_Model_1_0_2/modeling_layer/layer1/bw/bw/while/dropout/random_uniform/sub': Unknown input node '^polymath1_model_Polymath1_Model_1_0_2/modeling_layer/layer1/bw/bw/while/Identity'
W tensorflow/contrib/tensorrt/convert/convert_graph.cc:794] Failed to register segment graphdef as a function 7: Invalid argument: Node 'polymath1_model_Polymath1_Model_1_0_2/embedding_layer_5/bidirectional_rnn/fw/fw/while/dropout/random_uniform/sub': Unknown input node '^polymath1_model_Polymath1_Model_1_0_2/embedding_layer_5/bidirectional_rnn/fw/fw/while/Identity'
W tensorflow/contrib/tensorrt/convert/convert_graph.cc:794] Failed to register segment graphdef as a function 8: Invalid argument: Node 'polymath1_model_Polymath1_Model_1_0_2/embedding_layer_4/bidirectional_rnn/fw/fw/while/dropout/random_uniform/sub': Unknown input node '^polymath1_model_Polymath1_Model_1_0_2/embedding_layer_4/bidirectional_rnn/fw/fw/while/Identity'
但是这些不带符号“ ^”的未知输入名称实际上存在于GraphDef 中。 然后,之后出现了这样的错误:
E tensorflow/contrib/tensorrt/log/trt_logger.cc:38] DefaultLogger Parameter check failed at: Network.cpp::addInput::281, condition: isIndexedCHW(dims) && volume(dims) < MAX_TENSOR_SIZE
我不确定警告是否直接导致了错误,或者只是两个要解决的问题?
我尝试了两种方法来生成protobuf(.pb)二进制文件,一种方法是使用“ freeze_graph ”工具,另一种方法是在其中调用“ convert_variables_to_constants ”训练好的图形准备好后立即执行“ tf.graph_util”。生成的二进制文件都导致相同的情况。
重要库的版本: tensorflow-gpu(1.10.0) 张量(3.0.4) (https://devblogs.nvidia.com/tensorrt-integration-speeds-tensorflow-inference/此示例有效。)
谢谢!