Skip to content

[Tosa] : Equalize ranks for all operands for tosa.select + Slice conv inputs for dynamic batch as long as spatial dims are static. #4162

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sahas3
Copy link
Member

@sahas3 sahas3 commented Apr 25, 2025

Fixes a bug where not all operands of tosa.select had same rank. Looked at other uses of tosa.select op in the code and they all looked correct to me.

@sahas3
Copy link
Member Author

sahas3 commented Apr 25, 2025

@justin-ngo-arm : just for clarification was it a conscious choice to not use CreateOpAndInferShape calls for creating tosa ops here? I see that command being used in the tfl-to-tosa lowering on TensorFlow side. Thanks!

@sahas3 sahas3 requested a review from sjarus April 25, 2025 12:32
@sahas3 sahas3 changed the title [Tosa] : Equalize ranks for all operands for tosa.select. [Tosa] : Equalize ranks for all operands for tosa.select + Slice conv inputs for dynamic batch as long as spatial dims are static. Apr 25, 2025
@sahas3
Copy link
Member Author

sahas3 commented Apr 25, 2025

Fixes a bug where not all operands of tosa.select had same rank. Looked at other uses of tosa.select op in the code and they all looked correct to me.

Added another bugfix to handle dynamic batch when slicing inputs are required to honor the checks like 'tosa.conv2d' op expected input_height - 1 + pad_top + pad_bottom - (kernel_height - 1) * dilation_y to be wholly divisible by stride_y

@justin-ngo-arm
Copy link
Contributor

@justin-ngo-arm : just for clarification was it a conscious choice to not use CreateOpAndInferShape calls for creating tosa ops here? I see that command being used in the tfl-to-tosa lowering on TensorFlow side. Thanks!

At one point in the past, I was working on refactoring to use CreateOpAndInferShape for TorchToTosa. However, TOSA is now more restrictive about broadcasting and same rank (with the SameOperandsAndResultsRank trait), which makes it more complicated to make that transition to CreateOpAndInferShape.

cc: @sjarus

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