[Mlir-commits] [mlir] [mlir][tensor] Add tests to invalid.mlir (PR #112759)
Javed Absar
llvmlistbot at llvm.org
Thu Oct 17 16:01:09 PDT 2024
================
@@ -213,6 +213,27 @@ func.func @extract_slice_wrong_result_rank(%t: tensor<?xf32>, %idx : index) {
return
}
+
+// -----
+
+func.func @extract_slice_size_and_output_dim_mismatch_static_size(%t: tensor<16xf32>) {
+ // expected-error @+1 {{expected type to be 'tensor<4xf32>' or a rank-reduced version. (size mismatch)}}
+ %0 = tensor.extract_slice %t[0][4][1]
+ : tensor<16xf32> to tensor<6xf32>
+
+ return
+}
+
+// -----
+
+func.func @extract_slice_size_and_output_dim_mismatch_dynamic_size(%t: tensor<?xf32>, %idx : index) {
+ // expected-error @+2 {{expected type to be 'tensor<?xf32>' or a rank-reduced version. (size mismatch)}}
+ %c4 = arith.constant 4 : index
+ %0 = tensor.extract_slice %t[0][%c4][1] : tensor<?xf32> to tensor<4xi8>
----------------
javedabsar1 wrote:
ok I think i am missing something here which maybe you need to explain just for my sake. Above is not rank-reduced case.%c4 is 4. Is it that the return is still expected to be `tensor<?x4>` because value of '4' is not rolled into the extract_slice type deduction so to say.
https://github.com/llvm/llvm-project/pull/112759
More information about the Mlir-commits
mailing list