After adding preprocessing steps to the model, on inference an error throws: Non-zero status code returned while running Add node. #20984
Labels
api
issues related to all other APIs: C, C++, Python, etc.
platform:windows
issues related to the Windows platform
Describe the issue
I added preprocessing steps for TrOCR but now I get the following error: onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Add node. Name:'/embeddings/Add' Status Message: C:\a_work\1\s\onnxruntime\core/providers/cpu/math/element_wise_ops.h:560 onnxruntime::BroadcastIterator::Append axis == 1 || axis == largest was false. Attempting to broadcast an axis by a dimension other than 1. 386 by 578
To reproduce
This is my code, how i add it:
model = onnx.load("trocr_onnx/encoder_model.onnx")
inputs = [create_named_value('image', onnx.TensorProto.UINT8, ['num_bytes'])]
pipeline = PrePostProcessor(inputs, 18)
pipeline.add_pre_processing(
[
ConvertImageToBGR(),
Resize((384, 384), policy='not_larger'),
ChannelsLastToChannelsFirst(),
ImageBytesToFloat(),
Normalize([(0.5, 0.5), (0.5, 0.5), (0.5, 0.5)]),
Unsqueeze([0]),
]
)
modified_model = pipeline.run(model)
onnx.checker.check_model(modified_model)
onnx.save_model(modified_model, 'trocr_encoder.onnx')
Urgency
No response
Platform
Windows
OS Version
10
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
1.18.0
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: