Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Gouveia__César
New Contributor I
119 Views

Shape error in broadcast_sub while generating IR model for Unet

Hi!

I tried to convert a UNET MXNet model (for segmentation) to an optimized Intermediate Representation (IR) using the openVINO toolkit. I used the following command to convert:

python deployment_tools\model_optimizer\mo_mxnet.py --input_model mxnet_models\unet_mxnet_model-0000.params --input_shape (1,3,224,224) --scale 255 --output_dir converted_IR_models\

But when I try to run it it shows the following error:

[ ERROR ]  Shape [  1 224 224  -1] is not fully defined for output 0 of "broadcast_sub1/add_". Use --input_shape with positive integers to override model input shapes.
[ ERROR ]  Cannot infer shapes or values for node "broadcast_sub1/add_".
[ ERROR ]  Not all output shapes were inferred or fully defined for node "broadcast_sub1/add_".
 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 Elementwise.__init__.<locals>.<lambda> at 0x0000011E36761510>.
[ 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).

 

I don't understand why this operation doesn't work, in the new release notes (Release 3) is said that the new version provides support to the broadcast_sub operation for MXNet. Does the toolkit fully supports this operation? or is there something I'm doing wrong?

Thanks,

César.

0 Kudos
3 Replies
Shubha_R_Intel
Employee
119 Views

Dear Gouveia, César,

It doesn't at all seem to me that you are doing something wrong. You are on OpenVino 2019 R3 correct ? If so, then this could be a bug. Thanks for your patience, we will look into it.

Shubha

 

Gouveia__César
New Contributor I
119 Views

Hi Shubha,

Yes, I'm on the latest release (OpenVino 2019 R3), so broadcast_sub should work for any network configuration in MXNet. There's anything I can do to search or debug the error? I would appreciate if you look into the error. I will try to reproduce it using a less "complex" neural network.

Thanks, 

César.

Gouveia__César
New Contributor I
119 Views

Hi Shubha,

I found that this problem is more stranger than expected. My model uses a softmax that uses a set of operations:

  • max
  • broadcast_sub
  • exp
  • sum
  • broadcast_div

This is the sequence of operations (provided by the mxnet json):

{
  "op": "max", 
  "name": "max1", 
  "attrs": {
    "axis": "3", 
    "keepdims": "True"
  }, 
  "inputs": [[141, 0, 0]]
}, 
{
  "op": "broadcast_sub", 
  "name": "broadcast_sub1", 
  "inputs": [[141, 0, 0], [142, 0, 0]]
}, 
{
  "op": "exp", 
  "name": "exp1", 
  "inputs": [[143, 0, 0]]
}, 
{
  "op": "sum", 
  "name": "sum1", 
  "attrs": {
    "axis": "3", 
    "keepdims": "True"
  }, 
  "inputs": [[144, 0, 0]]
}, 
{
  "op": "broadcast_div", 
  "name": "broadcast_div1", 
  "inputs": [[144, 0, 0], [145, 0, 0]]
}

The new openvino release (R3.*) states that it supports all of those operations except for sum. So what I did was implementing this sum operating as a custom operation, creating a sum_ext.py and a sum.py (I will attach both files in the end).

This is the strange behavior:
When I try to run the model converter without the sum support (sum.py and sum_ext.py) the model complains about not supporting the sum operation, and this is correct. Moreover, it does not complain about broadcast_sub, which means that it should be working fine.
After I add the sum support, the model converter complains about the error above (shape is not fully defined...). So my question is, could this error come from my custom implementation of the sum operation? And not a bug of openvino
​​​​
Thanks again,

César.

Reply