Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Medhat__Amr
Beginner
176 Views

Problem when converting RealDiv layer [Tensorflow]

Hey,

I have a problem when converting my own .pb file,

when I get deeper into the error occured I found out that the problem is with RealDiv layer as I can cut the model before this layer and converting it successfully. But strting from  this layer I face a problem that I got an empty tensor which yields to the error below :

NODE NAME =  GlobalContext/div_3/reciprocal_
tensor shape  =  []
op shape  =  []
[ ERROR ]  -------------------------------------------------
[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID (<class 'extensions.middle.EltwiseChecker.EltwiseChecker'>)": index -1 is out of bounds for axis 0 with size 0
[ ERROR ]  Traceback (most recent call last):
  File "/opt/intel/openvino_2019.2.275/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.2.275/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.2.275/deployment_tools/model_optimizer/extensions/middle/EltwiseChecker.py", line 82, in find_and_replace_pattern
    np.put(possible_shape, feature_dim, tensor_shape.item(feature_dim))
IndexError: index -1 is out of bounds for axis 0 with size 0

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

Traceback (most recent call last):
  File "/opt/intel/openvino_2019.2.275/deployment_tools/model_optimizer/mo/main.py", line 302, in main
    return driver(argv)
  File "/opt/intel/openvino_2019.2.275/deployment_tools/model_optimizer/mo/main.py", line 251, in driver
    is_binary=not argv.input_model_is_text)
  File "/opt/intel/openvino_2019.2.275/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 134, in tf2nx
    class_registration.apply_replacements(graph, class_registration.ClassType.MIDDLE_REPLACER)
  File "/opt/intel/openvino_2019.2.275/deployment_tools/model_optimizer/mo/utils/class_registration.py", line 299, in apply_replacements
    )) from err
Exception: Exception occurred during running replacer "REPLACEMENT_ID (<class 'extensions.middle.EltwiseChecker.EltwiseChecker'>)": index -1 is out of bounds for axis 0 with size 0

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

Is there any special note about this layer in R2 ?  I'm using Tensorflow 1.14

0 Kudos
10 Replies
Shubha_R_Intel
Employee
176 Views

Dear Medhat, Amr,

First, please kindly upgrade to OpenVIno 2019R3. We just released it a couple of days ago.

The critical error I am seeing is this:

'extensions.middle.EltwiseChecker.EltwiseChecker'>)": index -1 is out of bounds for axis 0 with size 0

Here is how to debug this issue. Print a text version of your frozen pb.  For instance tensor shape = [] and op shape [] will cause trouble for the Model Optimizer.

NODE NAME =  GlobalContext/div_3/reciprocal_
tensor shape  =  []
op shape  =  []

When you print out your pb, look for layers in the neighborhood of GlobalContext/div_3/reciprocal_ including GlobalContext/div_3/reciprocal_ itself. Do you see any -1 in the input or output shape dimensions ?  If you do, you need to replace those with positive values. numpy knows how to deal with -1 in shape dimensions but Model Optimizer does not.

Something that can help is to pass --input_shape in with all positive values.

Hope it helps,

Thanks,

Shubha

 

Medhat__Amr
Beginner
176 Views

Dear Shubha,

I have already passed the input shape to be postive integers. I have printed a text version of my pb and I havn't found any -1 dimension.

I seems to be a problem with the reciprocal module within RealDiv layer as it yields an empty tensor !

Medhat__Amr
Beginner
176 Views

Could you please help me with this problem as it affects all my work and I tried everything that I can do. 

Thanks in advance

Shubha_R_Intel
Employee
176 Views

Dear Medhat, Amr,

Have you tried on the just released OpenVino 2019R3 ?

If not, please do. And report the results here.

Thanks for your patience,

Shubha

Medhat__Amr
Beginner
176 Views

Yes I have tried and the same error appears.

I have tried editing the source file of the division operation ( div.py) and have edited the graph connection to skip the reciprocal and it worked well. but this is not what I want.

yang__ming
Beginner
176 Views

dear Shubha

I met same problem as Medhat do, i put --input_shape [1280,1280,3], and i still got this node with tensor shape and op shape =[]

thx

Shubha_R_Intel
Employee
176 Views

Dear Medhat, Amr and/or yang, ming,

If you can attach each of your individual models as a *.zip, as well as the MO command(s) you used, that would be helpful. Tensorflow RealDiv is definitely supported by Model Optimizer so it could be a bug.

Thanks for trying it on R3 and also, thanks for your patience !

Shubha

 

 

 

Medhat__Amr
Beginner
176 Views

Dear Shubha, Could you please PM me so that I could send you the model as I can't release it in public.

Thanks in advance

yang__ming
Beginner
176 Views

python3 mo_tf.py --input_model /Users/myang/oss_model/detectforinvoice.pb --output_dir /Users/myang/oss_model --log_level=DEBUG --input_shape '[1280,1280,3]' --reverse_input_channels

im using tensflow 1.8.0 python3.6.5 and optimizer versioin is 2019.2.0-436-gf5827d4

above is the commomd used

thx

yang__ming
Beginner
176 Views

if i summerize the grpah i got 2 op All,Assert which not supported, is that the reason?

Reply