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.
6480 Discussions

Tensorflow to IR conversion error with tf.gather

Gupta__Shubham
New Contributor I
1,167 Views

Hi ,

I am using latest openvino 2021.2  and tensorflow 2.4.0 on my ubuntu 18.04 machine.

I am trying to convert my custom model from tensorflow to openvino IR but getting an error :

 

 


[ ERROR ] -------------------------------------------------
[ ERROR ] ----------------- INTERNAL ERROR ----------------
[ ERROR ] Unexpected exception happened.
[ ERROR ] Please contact Model Optimizer developers and forward the following information:
[ ERROR ] Power operation StatefulPartitionedCall/model/postprocess_layer/floordiv_2/Div/reciprocal_ has inputs of different data types: <class 'numpy.int32'> and float32
[ ERROR ] Traceback (most recent call last):
File "/opt/intel/openvino_2021.2.185/deployment_tools/model_optimizer/mo/main.py", line 297, in main
ret_code = driver(argv)
File "/opt/intel/openvino_2021.2.185/deployment_tools/model_optimizer/mo/main.py", line 264, in driver
ret_res = emit_ir(prepare_ir(argv), argv)
File "/opt/intel/openvino_2021.2.185/deployment_tools/model_optimizer/mo/main.py", line 248, in emit_ir
meta_info=get_meta_info(argv))
File "/opt/intel/openvino_2021.2.185/deployment_tools/model_optimizer/mo/pipeline/common.py", line 208, in prepare_emit_ir
type_infer(graph)
File "/opt/intel/openvino_2021.2.185/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 270, in type_infer
node_type_infer(node)
File "/opt/intel/openvino_2021.2.185/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 288, in node_type_infer
node.type_infer(node)
File "/opt/intel/openvino_2021.2.185/deployment_tools/model_optimizer/extensions/ops/elementwise.py", line 144, in type_infer
node.soft_get('name'), in_type_0, in_type_1)
AssertionError: Power operation StatefulPartitionedCall/model/postprocess_layer/floordiv_2/Div/reciprocal_ has inputs of different data types: <class 'numpy.int32'> and float32

[ ERROR ] ---------------- END OF BUG REPORT --------------
[ ERROR ] -------------------------------------------------

 

 

I am getting this error when using tf.gather in my model graph, without that model conversion is working fine.

 

i am attaching my tensorflow saved_model for reference.

Any help would be great.

Thanks

Shubham Gupta

0 Kudos
1 Solution
Gupta__Shubham
New Contributor I
1,143 Views

It's solved! The problem was not with tf.gather, it was back tracing to floor "//" operation that i was doing. Model optimizer was not able to handle the data type conversion which tensorflow was handling automatically.

View solution in original post

0 Kudos
5 Replies
Gupta__Shubham
New Contributor I
1,166 Views

Here is the model that I'm trying to convert

0 Kudos
Gupta__Shubham
New Contributor I
1,154 Views

Also the command i used for conversion is:

python3 /opt/intel/openvino_2021/deployment_tools/model_optimizer/mo_tf.py --saved_model_dir prediction_model -o . --input_shape [1,512,512,3]

0 Kudos
Gupta__Shubham
New Contributor I
1,144 Views

It's solved! The problem was not with tf.gather, it was back tracing to floor "//" operation that i was doing. Model optimizer was not able to handle the data type conversion which tensorflow was handling automatically.

0 Kudos
Iffa_Intel
Moderator
1,142 Views

Greetings,


Glad to know that you had found the solution & thanks for sharing it.

This might help others in case they have the same problem.


If you don't have any further inquiries, shall I close this thread?



Sincerely,

Iffa


0 Kudos
Iffa_Intel
Moderator
1,137 Views

Greetings,


Intel will no longer monitor this thread since this issue has been resolved. If you need any additional information from Intel, please submit a new question.


Sincerely,

Iffa


0 Kudos
Reply