-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Describe the issue
I export the tinynet_a.in1k model with output class changed to 2. When I load the model with onnxruntime, I can successfully load weigths, but then I start to input a image tensor, there comes the error. There is no ReorderOutput node in my model. I have checked with Netron app. I tried onnxsim but still have this issue. Please help me fix it, thanks.
onnx runtime error: Non-zero status code returned while running ReorderOutput node. Name:'ReorderOutput_token_490' Status Message: E:_work\1\s\include\onnxruntime\core/common/logging/logging.h:371 onnxruntime::logging::LoggingManager::DefaultLogger Attempt to use DefaultLogger but none has been registered.
To reproduce
model = timm.create_model(model_name, pretrained=False, num_classes=num_classes)
state_dict = torch.load(checkpoint_path, map_location="cpu")
model.load_state_dict(state_dict)
model.eval()
x = torch.rand(1, 3, 640, 480, dtype=torch.float32)
onnx_path = "end2end_tinynet_model.onnx"
dynamic_axes = {
'input': {2: 'height', 3: 'width'}
}
torch.onnx.export(
model,
(x,),
onnx_path,
export_params=True,
verbose=False,
opset_version=18,
input_names=['input'],
output_names=['output'],
dynamic_axes=dynamic_axes,
keep_initializers_as_inputs=False,
dynamo=False
)
vector output_tensors = session.Run(
RunOptions{ nullptr },
input_names,
&input_tensor,
1,
output_names,
1
);
Urgency
very urgent
Platform
Windows
OS Version
win11
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
onnxruntime-win-x64-1.23.2
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response