tandede commented on PR #20161:
URL: https://github.com/apache/tvm/pull/20161#issuecomment-5384301096

   > allowzero only changes zero semantics, but this branch also bypasses -1 
inference. A valid non-constant (3, 4) input with shape [-1, 2] and allowzero=1 
reaches runtime with a literal -1 and fails with std::bad_alloc. Please keep 
the normal reshape path when no literal zero is present and add a regression 
test.
   
   Thanks for catching this. You’re right that `allowzero` should only change 
the interpretation when the target shape actually contains a literal zero; it 
should not bypass normal `-1` inference.
   
   I narrowed the special path to constant target shapes containing zero. With 
`allowzero=1` and `[-1, 2]`, a non-constant `(3, 4)` input now follows the 
normal reshape path and produces `(6, 2)`.
   
   I added the requested regression test and pushed the update in d20b94e. All 
five Reshape-related tests and the changed-file pre-commit checks pass.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to