Use proper extent expression for dynamic reshape extents#4479
Use proper extent expression for dynamic reshape extents#4479jacobhinkle wants to merge 8 commits intomainfrom
Conversation
|
!test --diff |
|
Review updated until commit 88166f8 Description
Changes walkthrough 📝
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
Looks like zero extents need special handling also. This could mean the extent expressions get complicated. |
|
!test |
|
!test --diff |
(Trust by verify) Is this necessary? Can we instead error out when |
Ah, thanks for pointing out the torch behavior. Let me try to guard against that properly. It will simplify these expressions considerably. |
Previously in dynamic reshapes we used the given
Vals as the output extents. However, these are not the actual extents since as of #590 it is valid to pass -1 as a dynamic reshape size. This PR replaces a val likei0with an expression that should be correct no matter what the actual values wind up being. For example:This type of expression is indeed verbose but it handles the cases where any of those dynamic scalars is -1 or any of the input dimensions is 0, avoiding division by zero error.
During concretization, these extents should get replaced by the usual multiply/ceilDiv expressions coming from the particular reshape transforms.
Fixes #4476
Related to Issue #249 and PR #590