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

ValueError: as_list() is not defined on an unknown TensorShape #1067

Open
dirkdevries96 opened this issue Sep 25, 2023 · 0 comments
Open

ValueError: as_list() is not defined on an unknown TensorShape #1067

dirkdevries96 opened this issue Sep 25, 2023 · 0 comments

Comments

@dirkdevries96
Copy link

Describe the bug

handlers\backend\resize.py doesn't work handle tensors with unknown shapes well.
The fix in #1017 does not seem to be applicable here.

This is the error that I get:

ValueError: in user code:

    File "c:\users\dirk\extrepos\onnx-tensorflow\onnx_tf\backend_tf_module.py", line 99, in __call__  *
        output_ops = self.backend._onnx_node_to_tensorflow_op(onnx_node,
    File "c:\users\dirk\extrepos\onnx-tensorflow\onnx_tf\backend.py", line 347, in _onnx_node_to_tensorflow_op  *
        return handler.handle(node, tensor_dict=tensor_dict, strict=strict)
    File "c:\users\dirk\extrepos\onnx-tensorflow\onnx_tf\handlers\handler.py", line 58, in handle  *
        cls.args_check(node, **kwargs)
    File "c:\users\dirk\extrepos\onnx-tensorflow\onnx_tf\handlers\backend\resize.py", line 68, in args_check  *
        x_shape = x.get_shape().as_list()

    ValueError: as_list() is not defined on an unknown TensorShape.

To Reproduce
Run this code with

import onnx
from onnx_tf.backend import prepare

onnx_model = onnx.load("model.onnx")
tf_rep = prepare(onnx_model)

tf_rep.export_graph("model.pb")

Onnx model:
https://drive.google.com/file/d/1Tnl6X0k0IuWgJWNkx8AyqsDZH7pSF_1E/view?usp=sharing

Python, ONNX, ONNX-TF, Tensorflow version

  • Python version: 3.10.11
  • ONNX version: 1.14.1
  • ONNX-TF version: 1.10.0
  • Tensorflow version: 2.13.9

Additional context

The model is taken straight from:
torchvision.models.detection.faster_rcnn.fasterrcnn_resnet50_fpn

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

1 participant