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

[tosa] : Handle CHW input for avgpool2d. #4042

Merged
merged 1 commit into from
Feb 26, 2025
Merged

Conversation

sahas3
Copy link
Member

@sahas3 sahas3 commented Feb 24, 2025

This PR fixes two issues:

  1. Avg(Max)Pool2d allows (C, H, W) as input which causes a failure when creating tosa.avg_pool2d or tosa.max_pool2d as those ops expects 4D (N, H, W, C) tensor. Fix is to add a N=1 dimension before creating the tosa ops.
  2. Avg(Max)Pool2d also allows kernel/stride to be specified as a tuple of single int, in which case the value is repeated for both H and W dims. This is currently not handled as well causing a segv when trying to access kernel[1]/stride[1]. Fix is to expand kernel/stride to be size 2 by repeating the first element.

@sahas3 sahas3 requested a review from sjarus February 24, 2025 01:53
Copy link
Collaborator

@sjarus sjarus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this!

@sjarus
Copy link
Collaborator

sjarus commented Feb 25, 2025

Could you please change the subject to [tosa] and use that as the prefix instead of '[Task]' @sahas3 ?

@sahas3 sahas3 changed the title [Task] : Handle CHW input for avgpool2d. [tosa] : Handle CHW input for avgpool2d. Feb 26, 2025
@sahas3 sahas3 enabled auto-merge (squash) February 26, 2025 02:24
@sahas3 sahas3 merged commit ac944a7 into llvm:main Feb 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants