Skip to content

Commit

Permalink
Make sure ONNX ops are run with opset bigger than 7.
Browse files Browse the repository at this point in the history
For some reason, for some ops, the opset version is set to the miniumum supported version. For certain ops, this is version 1. The ONNX runtime is printing a warning about any version less than 7. So, if the opset version is less than 7, opset_version.
  • Loading branch information
davidt0x committed Mar 19, 2024
1 parent 065fb63 commit f3e524d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modeci_mdf/functions/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ def run_onnx_op(
)

model_def = op.to_onnx(inputs)

# For some reason, for some ops, the opset version is set to the miniumum supported version.
# For certain ops, this is version 1. The ONNX runtime is printing a warning about any version
# less than 7. So, if the opset version is less than 7, set to opset_version.
if model_def.opset_import[0].version < 7:
model_def.opset_import[0].version = opset_version

return predict_with_onnxruntime(model_def, *input_vals)


Expand Down

0 comments on commit f3e524d

Please sign in to comment.