Convert with clamp when do input precision conversion
Details:
-
The
Sliceoperator withint64input will be insertedconvertoperator to convertint64 -> int32 -
The current
Convertwill convertint64_minto0, which creates an accuracy issue.
Tickets:
@mryzhov Could you check if ConvertPrecision should insert Clamp operator (or have special mode) in cases where simple value conversion may produce incorrect value?
@mryzhov Could you check if ConvertPrecision should insert Clamp operator (or have special mode) in cases where simple value conversion may produce incorrect value?
I have reviewed all comments, and I know this solution is not good. So I want to get suggestions from reviewer. I list all tests that I have tried.
- The
Clampoperator only supports float type for min/max, https://docs.openvino.ai/2025/documentation/openvino-ir-format/operation-sets/operation-specs/activation/clamp-1.html. That will make theINT32_MINlose data when doing conversion. - I used the
MaximumandMinimumoperators to implement the function, but theConvertPrecisionexecutes twice. And it reports some errors
A rather philosophical question: if we suppose that Convert works incorrectly in some cases (btw do you know what are the cases? Can you formulate the particular scenarios?), shouldn't we adjust the Convert behavior in the first place to avoid essentially the manual conversion? @praasz @mryzhov
I suggest merging this PR first: https://github.com/openvinotoolkit/openvino/pull/33250 These are the transformations changes that can be done independently. You'd just need to rebase.
I suggest merging this PR first: #33250 These are the transformations changes that can be done independently. You'd just need to rebase.
It looks like the separate PR will not pass the CI on its own, so we'll have to include the transformations changes here. @sgbihu could you please revert the revert and make the corresponding changes here, please?