Skip to content

Commit

Permalink
update filecheck test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanyo Kwok committed Jul 22, 2022
1 parent 6432021 commit 1e3bd68
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions test/Conversion/TorchToMhlo/view_like.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
// CHECK: %[[T1:.*]] = torch.prim.ListConstruct %[[INT]]-1, %[[INT]]224 : (!torch.int, !torch.int) -> !torch.list<int>
// CHECK: %[[T2:.*]] = torch_c.to_i64 %[[INT]]-1
// CHECK: %[[T3:.*]] = torch_c.to_i64 %[[INT224]]
// CHECK: %[[T4:.*]] = arith.trunci %[[T2]] : i64 to i32
// CHECK: %[[T5:.*]] = arith.trunci %[[T3]] : i64 to i32
// CHECK: %[[T6:.*]] = tensor.from_elements %[[T4]], %[[T5]] : tensor<2xi32>
// CHECK: %[[T7:.*]] = "chlo.dynamic_reshape"(%[[T0]], %[[T6]]) : (tensor<?x?x?x?xf32>, tensor<2xi32>) -> tensor<?x224xf32>
// CHECK: %[[T8:.*]] = torch_c.from_builtin_tensor %[[T7]] : tensor<?x224xf32> -> !torch.vtensor<[?,224],f32>
// CHECK: return %[[T8]] : !torch.vtensor<[?,224],f32>
// CHECK: %[[T4:.*]] = tensor.from_elements %[[T2]], %[[T3]] : tensor<2xi64>
// CHECK: %[[T5:.*]] = "chlo.dynamic_reshape"(%[[T0]], %[[T4]]) : (tensor<?x?x?x?xf32>, tensor<2xi64>) -> tensor<?x224xf32>
// CHECK: %[[T6:.*]] = torch_c.from_builtin_tensor %[[T5]] : tensor<?x224xf32> -> !torch.vtensor<[?,224],f32>
// CHECK: return %[[T6]] : !torch.vtensor<[?,224],f32>
func.func @torch.aten.view$view_like(%arg0: !torch.vtensor<[?,?,?,?],f32>) -> !torch.vtensor<[?,224],f32> {
%int-1 = torch.constant.int -1
%int224 = torch.constant.int 224
Expand All @@ -35,14 +33,10 @@ func.func @torch.aten.view$view_like(%arg0: !torch.vtensor<[?,?,?,?],f32>) -> !t
// CHECK: %[[T3:.*]] = torch_c.to_i64 %[[INT120]]
// CHECK: %[[T4:.*]] = torch_c.to_i64 %[[INT4]]
// CHECK: %[[T5:.*]] = torch_c.to_i64 %[[INT64]]
// CHECK: %[[T6:.*]] = arith.trunci %[[T2]] : i64 to i32
// CHECK: %[[T7:.*]] = arith.trunci %[[T3]] : i64 to i32
// CHECK: %[[T8:.*]] = arith.trunci %[[T4]] : i64 to i32
// CHECK: %[[T9:.*]] = arith.trunci %[[T5]] : i64 to i32
// CHECK: %[[T10:.*]] = tensor.from_elements %[[T6]], %[[T7]], %[[T8]], %[[T9]] : tensor<4xi32>
// CHECK: %[[T11:.*]] = "chlo.dynamic_reshape"(%[[T0]], %[[T10]]) : (tensor<?x?x?x?x?xf32>, tensor<4xi32>) -> tensor<?x120x4x64xf32>
// CHECK: %[[T12:.*]] = torch_c.from_builtin_tensor %[[T11]] : tensor<?x120x4x64xf32> -> !torch.vtensor<[?,120,4,64],f32>
// CHECK: return %[[T12]] : !torch.vtensor<[?,120,4,64],f32>
// CHECK: %[[T6:.*]] = tensor.from_elements %[[T2]], %[[T3]], %[[T4]], %[[T5]] : tensor<4xi64>
// CHECK: %[[T7:.*]] = "chlo.dynamic_reshape"(%[[T0]], %[[T6]]) : (tensor<?x?x?x?x?xf32>, tensor<4xi64>) -> tensor<?x120x4x64xf32>
// CHECK: %[[T8:.*]] = torch_c.from_builtin_tensor %[[T7]] : tensor<?x120x4x64xf32> -> !torch.vtensor<[?,120,4,64],f32>
// CHECK: return %[[T8]] : !torch.vtensor<[?,120,4,64],f32>
func.func @torch.aten.reshape$view_like(%arg0: !torch.vtensor<[?,?,?,?,?],f32>) -> !torch.vtensor<[?,120,4,64],f32> {
%int-1 = torch.constant.int -1
%int120 = torch.constant.int 120
Expand All @@ -66,13 +60,10 @@ func.func @torch.aten.reshape$view_like(%arg0: !torch.vtensor<[?,?,?,?,?],f32>)
// CHECK: %[[T4:.*]] = torch_c.to_i64 %[[T1]]
// CHECK: %[[T5:.*]] = torch_c.to_i64 %[[T2]]
// CHECK: %[[T6:.*]] = torch_c.to_i64 %[[INT]]-1
// CHECK: %[[T7:.*]] = arith.trunci %[[T4]] : i64 to i32
// CHECK: %[[T8:.*]] = arith.trunci %[[T5]] : i64 to i32
// CHECK: %[[T9:.*]] = arith.trunci %[[T6]] : i64 to i32
// CHECK: %[[T10:.*]] = tensor.from_elements %[[T7]], %[[T8]], %[[T9]] : tensor<3xi32>
// CHECK: %[[T11:.*]] = "chlo.dynamic_reshape"(%[[T0]], %[[T10]]) : (tensor<2x3x?x?xf32>, tensor<3xi32>) -> tensor<2x3x?xf32>
// CHECK: %[[T12:.*]] = torch_c.from_builtin_tensor %[[T11]] : tensor<2x3x?xf32> -> !torch.vtensor<[2,3,?],f32>
// CHECK: return %[[T12]] : !torch.vtensor<[2,3,?],f32>
// CHECK: %[[T7:.*]] = tensor.from_elements %[[T4]], %[[T5]], %[[T6]] : tensor<3xi64>
// CHECK: %[[T8:.*]] = "chlo.dynamic_reshape"(%[[T0]], %[[T7]]) : (tensor<2x3x?x?xf32>, tensor<3xi64>) -> tensor<2x3x?xf32>
// CHECK: %[[T9:.*]] = torch_c.from_builtin_tensor %[[T8]] : tensor<2x3x?xf32> -> !torch.vtensor<[2,3,?],f32>
// CHECK: return %[[T9]] : !torch.vtensor<[2,3,?],f32>
func.func @torch.aten.view.minus1$view_like(%arg0: !torch.vtensor<[2,3,?,?],f32>) -> !torch.vtensor<[2,3,?],f32> {
%int-1 = torch.constant.int -1
%int1 = torch.constant.int 1
Expand Down

0 comments on commit 1e3bd68

Please sign in to comment.