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

Fix bug when sess.run returns list of empty list #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MatchaChoco010
Copy link

I have this error when run onnxsim.

Traceback (most recent call last):
  File "F:\github.com\MatchaChoco010\streaming-vc-test\streaming_asr\extract_onnx.py", line 59, in <module>
    enc, check = simplify(enc)
  File "F:\github.com\MatchaChoco010\streaming-vc-test\.venv\lib\site-packages\onnxsim\onnx_simplifier.py", line 186, in simplify
    model_opt_bytes = C.simplify(
  File "F:\github.com\MatchaChoco010\streaming-vc-test\.venv\lib\site-packages\onnxsim\onnx_simplifier.py", line 248, in Run
    return [
  File "F:\github.com\MatchaChoco010\streaming-vc-test\.venv\lib\site-packages\onnxsim\onnx_simplifier.py", line 249, in <listcomp>
    onnx.numpy_helper.from_array(x).SerializeToString() for x in output_arrs
  File "F:\github.com\MatchaChoco010\streaming-vc-test\.venv\lib\site-packages\onnx\numpy_helper.py", line 114, in from_array
    tensor.dims.extend(arr.shape)
AttributeError: 'list' object has no attribute 'shape'

This error seems to occur when sess.run returns a list of an empty list instead of a list of numpy arrays.
When sess.run returns a list, I replaced it with an empty numpy array and the error disappeared.

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

Successfully merging this pull request may close these issues.

1 participant