onnxruntime/onnxruntime
Aditya Goel ed41a2836c
Fix cast removal bug (#17953)
The `RemoveDuplicateCastTransformer` fairly naively removed Cast nodes
from the graph without considering precision loss when using the same
`TypeGroup`. For instance, F64 -> F32 -> F64 would be optimised out of
the graph.

I also noticed that signedness was not accounted for, which is not
covered by any existing issue but is a problem. For example doing int ->
unsigned int -> int produces very different values for negative inputs
and so should not be optimised out

One could argue that we shouldn't be performing such cast elimination at
all (at least not in this transformer). The original scope might be well
restricted to only eliminating unnecessary casts from the
`InsertCastTransformer` and no others.

### Motivation and Context
This should fix https://github.com/microsoft/onnxruntime/issues/17565,
ttps://github.com/microsoft/onnxruntime/issues/9915 and
https://github.com/microsoft/onnxruntime/issues/8787.
2023-10-31 15:48:32 -07:00
..
contrib_ops [CUDA] Update GroupNorm and Add SkipGroupNorm (#18091) 2023-10-31 10:27:20 -07:00
core Fix cast removal bug (#17953) 2023-10-31 15:48:32 -07:00
python [CUDA] Update GroupNorm and Add SkipGroupNorm (#18091) 2023-10-31 10:27:20 -07:00
test Fix cast removal bug (#17953) 2023-10-31 15:48:32 -07:00
tool/etw
wasm [js/web/training] Add CreateTrainingSession (#17891) 2023-10-26 09:22:10 -07:00
__init__.py Python API to check whether collective ops are available or not (#17730) 2023-09-29 14:11:05 -07:00
ReformatSource.ps1
ReformatSourcePython.bat
VSCodeCoverage.runsettings