Skip to content

Commit 90e76a7

Browse files
committed
[OnnxToTorch][GridSample] Add lit test for border padding mode
1 parent 45947d3 commit 90e76a7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/Conversion/TorchOnnxToTorch/simple_ops_g_to_p.mlir

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,18 @@ func.func @test_grid_sampler02(%arg0: !torch.vtensor<[5,10,10,4],f32>, %arg1: !t
965965

966966
// -----
967967

968+
// CHECK-LABEL: @test_grid_sampler03
969+
// CHECK: %[[INT0:.*]] = torch.constant.int 0
970+
// CHECK: %[[INT1:.*]] = torch.constant.int 1
971+
// CHECK: %[[B0:.*]] = torch.constant.bool true
972+
// CHECK: %[[A0:.*]] = torch.aten.grid_sampler %arg0, %arg1, %[[INT0]], %[[INT1]], %[[B0]] : !torch.vtensor<[5,10,10,4],f32>
973+
func.func @test_grid_sampler03(%arg0: !torch.vtensor<[5,10,10,4],f32>, %arg1: !torch.vtensor<[5,7,8,2],f32>) -> !torch.vtensor<[?,?,?,?],f32> attributes {torch.onnx_meta.ir_version = 9 : si64, torch.onnx_meta.opset_version = 17 : si64, torch.onnx_meta.producer_name = "backend-test", torch.onnx_meta.producer_version = ""} {
974+
%0 = torch.operator "onnx.GridSample" (%arg0, %arg1) {torch.onnx.align_corners = 1 : si64, torch.onnx.padding_mode = "border"} : (!torch.vtensor<[5,10,10,4],f32>, !torch.vtensor<[5,7,8,2],f32>) -> !torch.vtensor<[?,?,?,?],f32>
975+
return %0 : !torch.vtensor<[?,?,?,?],f32>
976+
}
977+
978+
// -----
979+
968980
// CHECK-LABEL: func.func @test_oldest_pad
969981
func.func @test_oldest_pad(%arg0: !torch.vtensor<[3,4],f32>) -> !torch.vtensor<[5,4],f32> attributes {torch.onnx_meta.opset_version = 1 : si64} {
970982
// CHECK: %[[int0:.*]] = torch.constant.int 0

0 commit comments

Comments
 (0)