Fix slice_scatter open end - #4512
Conversation
442b3bc to
277fcdb
Compare
| update = torch.randn(2, 4, 13, 8) | ||
| self.run_test(module, [cache, update]) | ||
|
|
||
| def test_full_overwrite_is_identity(self): |
There was a problem hiding this comment.
Dynamic sliced dimensions remain broken. The clamp is skipped when dim_size == DYNAMIC_DIM The code then reaches np.arange(0, 2**63-1), causing compilation failure or a huge-allocation error. The existing dynamic test varies batch and other dimensions while keeping the sliced dimension fixed at 64, so it does not cover this. We should include this test
There was a problem hiding this comment.
Should we land dynamic support here or keep in torch and follow up?
There was a problem hiding this comment.
yeah we can have it another PR. Just that we should have a validator then
277fcdb to
8a66bc6
Compare
|
_needs_dim_size() misses a case when the dim_is_static=False . A positive literal bound slips through unchecked. resolve_slice_scatter_write does correctly attempt to guard the dynamic-dim case:
I think we should widen the _needs_dim_size so concrete bound on dim isnt considered safe |
Description
Export encodes open-ended slice ends as 2**63-1. The converter feeds that into np.arange / broadcast_to without clamping to the dim size, causing “array is too big” or broadcast errors.
Clamp end (and related bounds) to the input length along dim before building NumPy indices, matching aten runtime behavior.
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: