Skip to content

Instantly share code, notes, and snippets.

@AmosLewis
Last active April 22, 2024 23:38
Show Gist options
  • Save AmosLewis/d0f3aa5dbb3743b6f78a6de0817b7f5b to your computer and use it in GitHub Desktop.
Save AmosLewis/d0f3aa5dbb3743b6f78a6de0817b7f5b to your computer and use it in GitHub Desktop.
module attributes {torch.debug_module_name = "avgpool2d"} {
func.func @forward(%arg0: !torch.vtensor<[32,384,25,25],f32>) -> !torch.vtensor<[32,384,25,25],f32> {
%int1_0 = torch.constant.int 1
%int1_1 = torch.constant.int 1
%int1_2 = torch.constant.int 1
%int1_3 = torch.constant.int 1
%int1_4 = torch.constant.int 1
%int1_5 = torch.constant.int 1
%int3_0 = torch.constant.int 3
%int3_1 = torch.constant.int 3
%none = torch.constant.none
%false_0 = torch.constant.bool false
%false_1 = torch.constant.bool false
%kernel_size = torch.prim.ListConstruct %int3_0, %int3_1 : (!torch.int, !torch.int) -> !torch.list<int>
%stride = torch.prim.ListConstruct %int1_0, %int1_1 : (!torch.int, !torch.int) -> !torch.list<int>
%padding = torch.prim.ListConstruct %int1_2, %int1_3, %int1_4, %int1_5 : (!torch.int, !torch.int, !torch.int, !torch.int) -> !torch.list<int>
%result = torch.aten.avg_pool2d %arg0, %kernel_size, %stride, %padding, %false_0, %false_1, %none : !torch.vtensor<[32,384,25,25],f32>, !torch.list<int>, !torch.list<int>, !torch.list<int>, !torch.bool, !torch.bool, !torch.none -> !torch.vtensor<[32,384,25,25],f32>
return %result : !torch.vtensor<[32,384,25,25],f32>
}
}
@AmosLewis
Copy link
Author

%1017 = torch.aten.avg_pool2d %857, %1014, %1016, %1015, %false_318, %false_319, %none_320 : !torch.vtensor<[32,384,25,25],f32>, !torch.list<int>, !torch.list<int>, !torch.list<int>, !torch.bool, !torch.bool, !torch.none -> !torch.vtensor<[32,384,25,25],f32>

%1014 = torch.prim.ListConstruct %int3_310, %int3_311 : (!torch.int, !torch.int) -> !torch.list<int>
%1015 = torch.prim.ListConstruct %int1_312, %int1_313, %int1_314, %int1_315 : (!torch.int, !torch.int, !torch.int, !torch.int) -> !torch.list<int>
%1016 = torch.prim.ListConstruct %int1_316, %int1_317 : (!torch.int, !torch.int) -> !torch.list<int>

@AmosLewis
Copy link
Author

  * Pattern : 'torch.aten.avg_pool2d -> ()' {
Trying to match "(anonymous namespace)::ConvertAtenAvgPoolOp<mlir::torch::Torch::AtenAvgPool2dOp, mlir::linalg::PoolingNchwSumOp, 2>"
    ** Insert  : 'torch_c.to_i64'(0x5cdabecc5460)
    ** Insert  : 'torch_c.to_i64'(0x5cdabecc59f0)
    ** Failure : unimplemented: count_include_pad is expected to be true
"(anonymous namespace)::ConvertAtenAvgPoolOp<mlir::torch::Torch::AtenAvgPool2dOp, mlir::linalg::PoolingNchwSumOp, 2>" result 0
  } -> FAILURE : pattern failed to match

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment