Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 0 has type numpy.int64, but expected one of: int #1

Closed
tomingliu opened this issue May 3, 2019 · 7 comments
Closed

TypeError: 0 has type numpy.int64, but expected one of: int #1

tomingliu opened this issue May 3, 2019 · 7 comments

Comments

@tomingliu
Copy link

Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/onnxsim/main.py", line 18, in
main()
File "/usr/local/lib/python3.6/dist-packages/onnxsim/main.py", line 12, in main
model_opt = onnxsim.simplify(args.input_model)
File "/usr/local/lib/python3.6/dist-packages/onnxsim/onnx_simplifier.py", line 179, in simplify
model_opt = eliminate_const_nodes(model_ori, get_constant_nodes(model_ori), forward_all(model_ori))
File "/usr/local/lib/python3.6/dist-packages/onnxsim/onnx_simplifier.py", line 130, in eliminate_const_nodes
vals=np.array(res[node.output[0]]).flatten().astype(get_np_type_from_elem_type(elem_type))
File "/usr/local/lib/python3.6/dist-packages/onnx/helper.py", line 173, in make_tensor
getattr(tensor, field).extend(vals)
TypeError: 0 has type numpy.int64, but expected one of: int

@daquexian
Copy link
Owner

Hi, thanks for your report!

Could you please provide the onnx model?

@tomingliu
Copy link
Author

The model size is too big to attach. could you pls let me know your mailbox? I'm sending model file by email??

@daquexian
Copy link
Owner

daquexian commented May 3, 2019 via email

@tomingliu
Copy link
Author

check you mailbox now, already sent to you

@daquexian
Copy link
Owner

daquexian commented May 3, 2019

@tomingliu The model got simplified successfully on my side. I think the error you met is caused by protobuf. Could you provide your protobuf version? It can be got by the following command

python3 -c "import google.protobuf; print(google.protobuf.__version__)"

And then please upgrade protobuf to the latest version and check if the error still exists.

@tomingliu
Copy link
Author

Than you for reply quickly! Problem was solved by upgrading protobuf from 3.0.0 to 3.7.1
thanks again!

daquexian added a commit that referenced this issue May 4, 2019
@daquexian
Copy link
Owner

daquexian commented May 4, 2019

Thanks for your report. Require protobuf>=3.7.0 in 468d60f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants