|
1 |
| -// RUN: torch-mlir-opt <%s -convert-torch-onnx-to-torch | FileCheck %s |
| 1 | +// RUN: torch-mlir-opt <%s --split-input-file -convert-torch-onnx-to-torch | FileCheck %s |
2 | 2 | // Generally, the test cases accumulated here come from running the importer
|
3 | 3 | // over all included backend tests that involve simple ops with no model
|
4 | 4 | // level constants. This is a pragmatic choice which lets us have a lot
|
@@ -438,6 +438,48 @@ func.func @test_cos(%arg0: !torch.vtensor<[3,4,5],f32>) -> !torch.vtensor<[3,4,5
|
438 | 438 | return %0 : !torch.vtensor<[3,4,5],f32>
|
439 | 439 | }
|
440 | 440 |
|
| 441 | +// ----- |
| 442 | + |
| 443 | +// CHECK-LABEL: @test_dequantizelinear_si8 |
| 444 | +func.func @test_dequantizelinear_si8(%arg0: !torch.vtensor<[6],si8>, %arg1: !torch.vtensor<[],f32>, %arg2: !torch.vtensor<[],si8>) -> !torch.vtensor<[6],f32> attributes {torch.onnx_meta.ir_version = 9 : si64, torch.onnx_meta.opset_version = 19 : si64} { |
| 445 | + %0 = torch.operator "onnx.DequantizeLinear"(%arg0, %arg1, %arg2) : (!torch.vtensor<[6],si8>, !torch.vtensor<[],f32>, !torch.vtensor<[],si8>) -> !torch.vtensor<[6],f32> |
| 446 | + // CHECK: %[[SCALE:.+]] = torch.aten.item %arg1 : !torch.vtensor<[],f32> -> !torch.float |
| 447 | + // CHECK: %[[ZP:.+]] = torch.aten.item %arg2 : !torch.vtensor<[],si8> -> !torch.int |
| 448 | + // CHECK: %[[MAKE:.+]] = torch.aten._make_per_tensor_quantized_tensor %arg0, %[[SCALE]], %[[ZP]] |
| 449 | + // CHECK: %[[DEQ:.+]] = torch.aten.dequantize.self %[[MAKE]] |
| 450 | + // CHECK: return %[[DEQ]] |
| 451 | + return %0 : !torch.vtensor<[6],f32> |
| 452 | +} |
| 453 | + |
| 454 | +// ----- |
| 455 | + |
| 456 | +// CHECK-LABEL: @test_dequantizelinear_ui8 |
| 457 | +func.func @test_dequantizelinear_ui8(%arg0: !torch.vtensor<[6],ui8>, %arg1: !torch.vtensor<[],f32>, %arg2: !torch.vtensor<[],ui8>) -> !torch.vtensor<[6],f32> attributes {torch.onnx_meta.ir_version = 9 : si64, torch.onnx_meta.opset_version = 19 : si64} { |
| 458 | + %0 = torch.operator "onnx.DequantizeLinear"(%arg0, %arg1, %arg2) : (!torch.vtensor<[6],ui8>, !torch.vtensor<[],f32>, !torch.vtensor<[],ui8>) -> !torch.vtensor<[6],f32> |
| 459 | + // CHECK: %[[SCALE:.+]] = torch.aten.item %arg1 : !torch.vtensor<[],f32> -> !torch.float |
| 460 | + // CHECK: %[[ZP:.+]] = torch.aten.item %arg2 : !torch.vtensor<[],ui8> -> !torch.int |
| 461 | + // CHECK: %[[MAKE:.+]] = torch.aten._make_per_tensor_quantized_tensor %arg0, %[[SCALE]], %[[ZP]] |
| 462 | + // CHECK: %[[DEQ:.+]] = torch.aten.dequantize.self %[[MAKE]] |
| 463 | + // CHECK: return %[[DEQ]] |
| 464 | + return %0 : !torch.vtensor<[6],f32> |
| 465 | +} |
| 466 | + |
| 467 | +// ----- |
| 468 | + |
| 469 | +// CHECK-LABEL: @test_dequantizelinear_i32 |
| 470 | +func.func @test_dequantizelinear_i32(%arg0: !torch.vtensor<[6],si32>, %arg1: !torch.vtensor<[],f32>, %arg2: !torch.vtensor<[],si32>) -> !torch.vtensor<[6],f32> attributes {torch.onnx_meta.ir_version = 9 : si64, torch.onnx_meta.opset_version = 19 : si64} { |
| 471 | + %0 = torch.operator "onnx.DequantizeLinear"(%arg0, %arg1, %arg2) : (!torch.vtensor<[6],si32>, !torch.vtensor<[],f32>, !torch.vtensor<[],si32>) -> !torch.vtensor<[6],f32> |
| 472 | + // CHECK: %[[SCALE:.+]] = torch.aten.item %arg1 : !torch.vtensor<[],f32> -> !torch.float |
| 473 | + // CHECK: %[[ZP:.+]] = torch.aten.item %arg2 : !torch.vtensor<[],si32> -> !torch.int |
| 474 | + // CHECK: %[[MAKE:.+]] = torch.aten._make_per_tensor_quantized_tensor %arg0, %[[SCALE]], %[[ZP]] |
| 475 | + // CHECK: %[[DEQ:.+]] = torch.aten.dequantize.self %[[MAKE]] |
| 476 | + // CHECK: return %[[DEQ]] |
| 477 | + return %0 : !torch.vtensor<[6],f32> |
| 478 | +} |
| 479 | + |
| 480 | +// ----- |
| 481 | + |
| 482 | + |
441 | 483 | // CHECK-LABEL: @test_div_bcast
|
442 | 484 | func.func @test_div_bcast(%arg0: !torch.vtensor<[3,4,5],f32>, %arg1: !torch.vtensor<[5],f32>) -> !torch.vtensor<[3,4,5],f32> attributes {torch.onnx_meta.ir_version = 7 : si64, torch.onnx_meta.opset_version = 14 : si64, torch.onnx_meta.producer_name = "backend-test", torch.onnx_meta.producer_version = ""} {
|
443 | 485 | // CHECK: torch.aten.div.Tensor %arg0, %arg1 : !torch.vtensor<[3,4,5],f32>, !torch.vtensor<[5],f32> -> !torch.vtensor<[3,4,5],f32>
|
|
0 commit comments