You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to run inference on a pretrained PyTorch model that has been converted to TensorFlow from ONNX, I get the following error:
ValueError: as_list() is not defined on an unknown TensorShape.
Inference using the onnx model with onnxruntime works fine, it's only when I convert it to TensorFlow that it fails. I've used this same code with other PyTorch models and it works fine, so I'm guessing it's related to the pretrained model.
To Reproduce
Here's a minimal example:
import torch
import torchvision
import onnx
from onnx_tf.backend import prepare
pt_model = torchvision.models.detection.maskrcnn_resnet50_fpn(weights="DEFAULT")
x = torch.randn(1, 3,800,800)
torch.onnx.export(pt_model, x, "torch.onnx")
model = onnx.load('torch.onnx')
tf_rep = prepare(model)
tf_output = tf_rep.run(x)
Describe the bug
When trying to run inference on a pretrained PyTorch model that has been converted to TensorFlow from ONNX, I get the following error:
ValueError: as_list() is not defined on an unknown TensorShape.
Inference using the onnx model with
onnxruntime
works fine, it's only when I convert it to TensorFlow that it fails. I've used this same code with other PyTorch models and it works fine, so I'm guessing it's related to the pretrained model.To Reproduce
Here's a minimal example:
ONNX model file
https://drive.google.com/file/d/1sw1GhywhFrpeO6zQSaz9hlop1SEnDYG_/view?usp=sharing
Python, ONNX, ONNX-TF, Tensorflow version
The text was updated successfully, but these errors were encountered: