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.

output array is read-only

Wu__Anthony
Beginner
906 Views

My model is onnx format generated by pytorch and I try to convert it to bin and xml, but it show the error "output array is read-only".

I see that other people on the Internet having this problem is about numpy's version, however, it seems not work for me.

I degrade the version numpy from 1.16.2 to 1.15.0, still doesn't work.

Any suggestion?

'''

  File "C:\Intel\computer_vision_sdk_2018.5.456\deployment_tools\model_optimizer\mo\main.py", line 325, in main
    return driver(argv)
  File "C:\Intel\computer_vision_sdk_2018.5.456\deployment_tools\model_optimizer\mo\main.py", line 302, in driver
    mean_scale_values=mean_scale)
  File "C:\Intel\computer_vision_sdk_2018.5.456\deployment_tools\model_optimizer\mo\pipeline\onnx.py", line 165, in driver
    fuse_linear_ops(graph)
  File "C:\Intel\computer_vision_sdk_2018.5.456\deployment_tools\model_optimizer\mo\middle\passes\fusing\fuse_linear_ops.py", line 258, in fuse_linear_ops
    is_fused = _fuse_add(graph, node, fuse_nodes)
  File "C:\Intel\computer_vision_sdk_2018.5.456\deployment_tools\model_optimizer\mo\middle\passes\fusing\fuse_linear_ops.py", line 212, in _fuse_add
    fuse_node.in_node(2).value += value
ValueError: output array is read-only
'''

0 Kudos
6 Replies
Shubha_R_Intel
Employee
906 Views

Dear Anthony,

This is indeed strange. 

I have messaged you so that you can send me your onnx model privately.

Thanks for using OpenVino !

Shubha

0 Kudos
Wu__Anthony
Beginner
906 Views

Hi, Shubha R.:

Thank you for your help.

I have already emailed you to "idz.admin@intel.com" or this is just a Forums Notification, because I receive any message in my Intel account.
Do I miss something?
Sorry for my late reply!

0 Kudos
Shubha_R_Intel
Employee
906 Views

Dear Anthony I did not receive anything from you.  I have once again sent you a PM message. Just kindly reply to it and attach your model as a zip file.

Thanks for using OpenVino !

Shubha

0 Kudos
Shubha_R_Intel
Employee
906 Views

Dearest Anthony,

Thank you for sending me your zipped up model over PM.

I've got good news and bad news. The bad news is that I reproduced your problem on OpenVino version computer_vision_sdk_2018.5.456 (commonly known as R5.1),  so you really did see a bug ! The good news is that it's been fixed in the latest OpenVino Release which dropped today (2019 R1). 

Thanks for using OpenVino !

Shubha

0 Kudos
Wu__Anthony
Beginner
906 Views

Hi Shubha R.,

Could you explain in more detail about this bug? I am just curious.

Because I comment out Line 224 to 260 in use_linear_ops.py and it work.

Thank you!

 

0 Kudos
Shubha_R_Intel
Employee
906 Views

Dear Anthony, 

So I performed a "diff" between the 5.1 version of fuse_linear_ops.py and the latest 2019 R1 version. What I noticed is that there is a slight redesign of the _fuse_mul, _fuse_add and fuse_linear_ops methods:

Version 2019 R1 method signature:

def _fuse_mul(graph: Graph, node: Node, fuse_nodes: list, backward: bool = True):

Version 5.1 method signature:

def _fuse_mul(graph: nx.MultiDiGraph, node: Node, fuse_nodes: list, backward: bool = True):

The main difference is the first argument.  So in all three methods 2019 R1 uses Graph rather than networkx.MultiDiGraph.

Looking through this file there are other minor changes also. I encourage you to do a "diff" yourself and see what the changes in this file are, after all OpenVino is open source !

Thanks for using OpenVino !

Shubha
 

0 Kudos
Reply