Created
February 28, 2024 21:28
-
-
Save AmosLewis/8618bc5e191674c30d03c50c4a921839 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module { | |
func.func @test_reduce_prod_default_axes_keepdims_random(%arg0: !torch.vtensor<[3,2,2],f32>) -> !torch.vtensor<[1,1,1],f32> attributes {torch.onnx_meta.ir_version = 8 : si64, torch.onnx_meta.opset_version = 18 : si64, torch.onnx_meta.producer_name = "backend-test", torch.onnx_meta.producer_version = ""} { | |
%int0 = torch.constant.int 0 | |
%int0_0 = torch.constant.int 0 | |
%int1 = torch.constant.int 1 | |
%int2 = torch.constant.int 2 | |
%0 = torch.aten.dim %arg0 : !torch.vtensor<[3,2,2],f32> -> !torch.int | |
%1 = torch.aten.lt.int %int0_0, %int0 : !torch.int, !torch.int -> !torch.bool | |
%2 = torch.aten.Int.bool %1 : !torch.bool -> !torch.int | |
%3 = torch.aten.mul.int %2, %0 : !torch.int, !torch.int -> !torch.int | |
%4 = torch.aten.add.int %int0_0, %3 : !torch.int, !torch.int -> !torch.int | |
%5 = torch.aten.lt.int %int1, %int0 : !torch.int, !torch.int -> !torch.bool | |
%6 = torch.aten.Int.bool %5 : !torch.bool -> !torch.int | |
%7 = torch.aten.mul.int %6, %0 : !torch.int, !torch.int -> !torch.int | |
%8 = torch.aten.add.int %int1, %7 : !torch.int, !torch.int -> !torch.int | |
%9 = torch.aten.lt.int %int2, %int0 : !torch.int, !torch.int -> !torch.bool | |
%10 = torch.aten.Int.bool %9 : !torch.bool -> !torch.int | |
%11 = torch.aten.mul.int %10, %0 : !torch.int, !torch.int -> !torch.int | |
%12 = torch.aten.add.int %int2, %11 : !torch.int, !torch.int -> !torch.int | |
%true = torch.constant.bool true | |
%none = torch.constant.none | |
%13 = torch.aten.prod.dim_int %arg0, %4, %true, %none : !torch.vtensor<[3,2,2],f32>, !torch.int, !torch.bool, !torch.none -> !torch.vtensor<[?,?,?],f32> | |
%14 = torch.aten.prod.dim_int %13, %8, %true, %none : !torch.vtensor<[?,?,?],f32>, !torch.int, !torch.bool, !torch.none -> !torch.vtensor<[?,?,?],f32> | |
%15 = torch.aten.prod.dim_int %14, %12, %true, %none : !torch.vtensor<[?,?,?],f32>, !torch.int, !torch.bool, !torch.none -> !torch.vtensor<[?,?,?],f32> | |
%int-1 = torch.constant.int -1 | |
%int-1_1 = torch.constant.int -1 | |
%int-1_2 = torch.constant.int -1 | |
%16 = torch.prim.ListConstruct %int-1, %int-1_1, %int-1_2 : (!torch.int, !torch.int, !torch.int) -> !torch.list<int> | |
%17 = torch.aten.reshape %15, %16 : !torch.vtensor<[?,?,?],f32>, !torch.list<int> -> !torch.vtensor<[1,1,1],f32> | |
return %17 : !torch.vtensor<[1,1,1],f32> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
torch-mlir-opt --convert-torch-onnx-to-torch --torch-decompose-complex-ops --cse --canonicalize ../onnx_torch_import_20231121/node_test_reduce_prod_default_axes_keepdims_random_model.mlir
torch-mlir-opt --convert-torch-to-linalg ../test/prod/node_test_reduce_prod_default_axes_keepdims_random_model_torch.mlir