-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Pull Request resolved: #979 Adds fx2ait converter for avg_pool3d Reviewed By: henryhu6 Differential Revision: D52232504 fbshipit-source-id: 8f2ad60cba3ef00d62b1d518bbd11618206fd759
- Loading branch information
1 parent
da97807
commit c1747f6
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary. | ||
import torch | ||
from fx2ait.acc_tracer import acc_ops | ||
from fx2ait.tools.common_fx2ait import AITTestCase | ||
from parameterized import parameterized | ||
|
||
|
||
class TestAvgPool3dConverter(AITTestCase): | ||
@parameterized.expand([(1, 1, 0), ((1, 1, 1), (1, 1, 1), (0, 0, 0))]) | ||
def test_avgpool3d(self, kernel_size, stride, padding): | ||
class TestModule(torch.nn.Module): | ||
def __init__(self, kernel_size, stride, padding): | ||
super().__init__() | ||
self.pool = torch.nn.AvgPool3d(kernel_size, stride, padding) | ||
|
||
def forward(self, x): | ||
return self.pool(x) | ||
|
||
model = TestModule(kernel_size, stride, padding).half().cuda() | ||
inputs = [torch.randn(1, 4, 256, 256, 256).cuda().half()] | ||
self.run_test( | ||
model, | ||
inputs, | ||
expected_ops={acc_ops.avg_pool3d}, | ||
) |