[Mlir-commits] [mlir] [tosa] : Get quantized element type with sign info. (PR #169387)

Sayan Saha llvmlistbot at llvm.org
Mon Nov 24 11:00:59 PST 2025


sahas3 wrote:

Found this issue when running `tf-tosa-opt --tosa-legalize-tfl` on the following IR:

```
func.func @main(%arg0:tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>) -> (tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>) {
    %0 = "tfl.relu"(%arg0) : (tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>) -> tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>
    return %0 : tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>
}
```
as it produces an invalid `tosa.clamp` due to the same root cause about not considering sign info:
```
 "tosa.clamp"(%3) <{max_val = -1 : i8, min_val = 0 : i8, nan_mode = "PROPAGATE"}> : (tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>) -> tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>
```
Planning to fix that issue in the tensorflow repo once this PR lands and it available there.

https://github.com/llvm/llvm-project/pull/169387


More information about the Mlir-commits mailing list