Skip to content

Fix cat dim on packed intx tensors#41

Open
eyupcanakman wants to merge 1 commit into
apple:mainfrom
eyupcanakman:fix/intx-cat-dim
Open

Fix cat dim on packed intx tensors#41
eyupcanakman wants to merge 1 commit into
apple:mainfrom
eyupcanakman:fix/intx-cat-dim

Conversation

@eyupcanakman

Copy link
Copy Markdown
Contributor

Description:

  • The aten.cat branch of SubbyteTensor.torch_dispatch reads dim through fill_defaults, then calls the op without passing it, so every cat on a packed intx or uintx tensor runs on dim 0. Two (2, 4) tensors with dim=1 give shape (4, 4) rather than (2, 8), and no error is raised. Inputs that differ along the requested axis instead fail with "Sizes of tensors must match except in dimension 0".
  • Pass dim to the op so cat runs on the requested dimension. The stack and slice branches beside it already forward their dim the same way. IntxTensor and UintxTensor share this branch, so both are fixed.

Testing

  • python unit test
  • Added cat tests for IntxTensor and UintxTensor over dim 0, 1 and -1. The dim=1 and dim=-1 cases fail on main and pass with the fix, and dim=0 passes either way.

The aten.cat branch of SubbyteTensor.__torch_dispatch__ reads dim via fill_defaults, then calls the op without it, so every cat runs on dim 0.
Two (2, 4) tensors with dim=1 give shape (4, 4) rather than (2, 8).
IntxTensor and UintxTensor share the branch, so both are affected.
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.

1 participant