[Mlir-commits] [mlir] [mlir][TOSA] Fix shape inference when operand was inferred (PR #66906)

Maya Amrami llvmlistbot at llvm.org
Wed Nov 1 08:37:30 PDT 2023


amrami wrote:

Hi!
I have a test that fails now after rebasing on master.
When I revert this commit it passes.
I minimized the test case to show the failure:

**Command**:
mlir-opt --tosa-infer-shapes

**Input**:
```
func.func @a(%arg0: tensor<1x1x1xf32>) -> (tensor<f32>) {
    %0 = tosa.reshape %arg0 {new_shape = array<i64: 1>} : (tensor<1x1x1xf32>) -> tensor<f32>
    return %0 : tensor<f32>
}
```

**Previous output**:
```
  func.func @a(%arg0: tensor<1x1x1xf32>) -> tensor<f32> {
    %0 = tosa.reshape %arg0 {new_shape = array<i64: 1>} : (tensor<1x1x1xf32>) -> tensor<f32>
    return %0 : tensor<f32>
  }
```

**Current output**:
```
<stdin>:2:10: error: 'tosa.reshape' op result #0 must be ranked tensor of number values, but got 'tensor<*xf32>'
    %0 = tosa.reshape %arg0 {new_shape = array<i64: 1>} : (tensor<1x1x1xf32>) -> tensor<f32>
         ^
<stdin>:2:10: note: see current operation: %0 = "tosa.reshape"(%arg0) <{new_shape = array<i64: 1>}> : (tensor<1x1x1xf32>) -> tensor<*xf32>
```

Do you think the previous output was wrong? Or maybe something broke with this change? 
Thanks in advance,
Maya

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


More information about the Mlir-commits mailing list