Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Shape is not defined for output 0 of

Lily__rivo
Beginner
203 Views
hello, i am attempting to optimize MetaGraph model about Tensorflow. I keep receiving the following issue when trying to produce the IR. as a beginner, i has no way to slove this...
[ 2019-12-30 10:44:52,271 ] [ DEBUG ] [ infer:131 ]  Op: ShapeOf
[ WARNING ]  ShapeOf operation should have exact one input node, but it has 0
[ 2019-12-30 10:44:52,272 ] [ DEBUG ] [ infer:142 ]  Inputs:
[ 2019-12-30 10:44:52,272 ] [ DEBUG ] [ infer:144 ]  Outputs:
[ 2019-12-30 10:44:52,272 ] [ DEBUG ] [ infer:32 ]  output[0]: shape = <UNKNOWN>, value = <UNKNOWN>
[ ERROR ]  Shape is not defined for output 0 of "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape".
[ ERROR ]  Cannot infer shapes or values for node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape".
[ ERROR ]  Not all output shapes were inferred or fully defined for node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
[ ERROR ]  
[ ERROR ]  It can happen due to bug in custom shape infer function <function Shape.infer at 0x7feb39db3d08>.
[ ERROR ]  Or because the node inputs have incorrect values/shapes.
[ ERROR ]  Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
[ 2019-12-30 10:44:52,275 ] [ DEBUG ] [ infer:196 ]  Node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape" attributes: {'pb': name: "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape"
op: "Shape"
input: "deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Tanh_1"
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "_output_shapes"
  value {
    list {
      shape {
        dim {
          size: 2
        }
      }
    }
  }
}
attr {
  key: "out_type"
  value {
    type: DT_INT32
  }
}
, '_in_ports': {0: {'control_flow': False}}, '_out_ports': {0: {'control_flow': False}}, 'kind': 'op', 'name': 'gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape', 'op': 'ShapeOf', 'precision': 'FP32', 'type': 'ShapeOf', 'infer': <function Shape.infer at 0x7feb39db3d08>, 'in_ports_count': 1, 'out_ports_count': 1, 'data_type': <class 'numpy.int32'>, 'dim_attrs': ['batch_dims', 'channel_dims', 'axis', 'spatial_dims'], 'shape_attrs': ['pad', 'window', 'shape', 'stride', 'output_shape'], 'IE': [('layer', [('id', <function Op.substitute_ie_attrs.<locals>.<lambda> at 0x7feb04b579d8>), 'name', 'precision', 'type'], [('data', [], []), '@ports', '@consts'])], 'is_output_reachable': True, 'is_undead': False, 'is_const_producer': False, 'is_partial_inferred': False}
[ ERROR ]  Not all output shapes were inferred or fully defined for node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
Stopped shape/value propagation at "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape" node. 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38. 
Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Not all output shapes were inferred or fully defined for node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
Stopped shape/value propagation at "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape" node. 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38. 
[ 2019-12-30 10:44:52,276 ] [ DEBUG ] [ main:304 ]  Traceback (most recent call last):
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 168, in partial_infer
    node_name)
mo.utils.error.Error: Not all output shapes were inferred or fully defined for node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/mo/utils/class_registration.py", line 273, in apply_replacements
    for_graph_and_each_sub_graph_recursively(graph, replacer.find_and_replace_pattern)
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/mo/middle/pattern_match.py", line 58, in for_graph_and_each_sub_graph_recursively
    func(graph)
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/extensions/middle/PartialInfer.py", line 31, in find_and_replace_pattern
    partial_infer(graph)
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 198, in partial_infer
    refer_to_faq_msg(38)) from err
mo.utils.error.Error: Not all output shapes were inferred or fully defined for node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
Stopped shape/value propagation at "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape" node. 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38. 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/mo/main.py", line 298, in main
    return driver(argv)
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/mo/main.py", line 247, in driver
    is_binary=not argv.input_model_is_text)
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 138, in tf2nx
    class_registration.apply_replacements(graph, class_registration.ClassType.MIDDLE_REPLACER)
  File "/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/mo/utils/class_registration.py", line 293, in apply_replacements
    )) from err
mo.utils.error.Error: Not all output shapes were inferred or fully defined for node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
Stopped shape/value propagation at "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape" node. 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38. 
Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Not all output shapes were inferred or fully defined for node "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
Stopped shape/value propagation at "gradients/deep_bidirectional_lstm/stack_bidirectional_rnn/cell_0/bidirectional_rnn/bw/bw/while/basic_lstm_cell/Mul_2_grad/Shape" node. 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38. 

 

0 Kudos
0 Replies
Reply