[Mlir-commits] [mlir] [mlir][tensor] Add tests to invalid.mlir (PR #112759)
Andrzej Warzyński
llvmlistbot at llvm.org
Fri Oct 18 00:56:10 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>
----------------
banach-space wrote:
Hopefully this will clarify things a little bit:
* https://discourse.llvm.org/t/tensor-ops-with-dynamic-sizes-which-behaviour-is-more-correct/
Importantly, this PR merely documents the current behaviour. And, I might be sending more following the Discourse post :)
Please let me know if this is still unclear 😅
https://github.com/llvm/llvm-project/pull/112759
More information about the Mlir-commits
mailing list