onnxruntime
onnxruntime copied to clipboard
[Training] Fix Overflow Handling in Cast Infer for ORTModule.
Description
Infer cast function in symbolic shape infer cannot handle inf values and returns this error:
File "/usr/local/lib/python3.10/dist-packages/onnxruntime/tools/symbolic_shape_infer.py", line 607, in int_or_float
return int(value)
OverflowError: cannot convert float infinity to integer
added a fix to handle NaN and inf values.