xref: /llvm-project/mlir/test/Examples/Toy/Ch4/transpose_transpose.toy (revision ee2c6cd9069fe0d8e7386ce53300e7645e4db792)
1a6b42716SLucy Fox# RUN: toyc-ch4 %s -emit=mlir -opt 2>&1 | FileCheck %s
2495cf272SLucy Fox
3495cf272SLucy Fox# User defined generic function that operates on unknown shaped arguments
4495cf272SLucy Foxdef transpose_transpose(x) {
5495cf272SLucy Fox  return transpose(transpose(x));
6495cf272SLucy Fox}
7495cf272SLucy Fox
8495cf272SLucy Foxdef main() {
9495cf272SLucy Fox  var a<2, 3> = [[1, 2, 3], [4, 5, 6]];
10495cf272SLucy Fox  var b = transpose_transpose(a);
11495cf272SLucy Fox  print(b);
12495cf272SLucy Fox}
13495cf272SLucy Fox
14*ee2c6cd9SRiver Riddle# CHECK-LABEL: toy.func @main()
15a6b42716SLucy Fox# CHECK-NEXT:    [[VAL_1:%.*]] = toy.constant dense<{{\[\[}}1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>
16a6b42716SLucy Fox# CHECK-NEXT:    toy.print [[VAL_1]] : tensor<2x3xf64>
17495cf272SLucy Fox# CHECK-NEXT:    toy.return