Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aten._adaptive_avg_pool2d.default #475

Open
ayerofieiev-tt opened this issue Nov 21, 2024 · 2 comments · May be fixed by #510
Open

aten._adaptive_avg_pool2d.default #475

ayerofieiev-tt opened this issue Nov 21, 2024 · 2 comments · May be fixed by #510
Assignees

Comments

@ayerofieiev-tt
Copy link
Member

No description provided.

@swimdi
Copy link
Collaborator

swimdi commented Nov 25, 2024

Need to solved tenstorrent/tt-metal#12151 or the ttnn.avg_pool2d cannot support case of output_size != [1, 1]

input = torch.randn([1, 512, 7, 7]).to(torch.bfloat16)
output_size = [7, 7]
adaptive_avg_pool2d = torch.ops.aten._adaptive_avg_pool2d.default(input, output_size)
print(adaptive_avg_pool2d.shape)
# torch.Size([1, 512, 7, 7])

@swimdi swimdi linked a pull request Nov 26, 2024 that will close this issue
@swimdi
Copy link
Collaborator

swimdi commented Nov 26, 2024

Sorry the above comment is wrong, please ignore it

Here is the description of aten._adaptive_avg_pool2d.default:

aten._adaptive_avg_pool2d.default is not same with aten.avg_pool2d.default, but it can convert to aten.avg_pool2d.default by mapping aten._adaptive_avg_pool2d.default's output_size argument to aten.avg_pool2d.default's stride & size by

Stride = (input_size//output_size)  
Kernel size = input_size - (output_size-1)*stride  
Padding = 0

So if want to support lowering of aten._adaptive_avg_pool2d.default, then it needs either ttnn.adaptive_avg_pool2d op for direct converting or ttnn.avg_pool2d with above adjust

But seems there no ttnn.adaptive_avg_pool2d op now, and ttnn.avg_pool2d is not finished according to tenstorrent/tt-metal#12151

Luckly, there's only one input variation appeared on models

Tensor<[1, 512, 7, 7]> self = ?, List[int] output_size = [7, 7]

And this input variation actually let aten._adaptive_avg_pool2d.default do nothing, so if we check these input varation type during lowering and just remove it, then we can say aten._adaptive_avg_pool2d.default is fully supported of the current scope of models, so the supporting of actul lowering maybe can set lower priority

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants