Skip to content

Fix cat dim on packed intx tensors - #41

Open
eyupcanakman wants to merge 2 commits into
apple:mainfrom
eyupcanakman:fix/intx-cat-dim
Open

Fix cat dim on packed intx tensors#41
eyupcanakman wants to merge 2 commits 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.
@jakesabathia2
jakesabathia2 self-requested a review July 23, 2026 18:51

@jakesabathia2 jakesabathia2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great fix! @eyupcanakman

@jakesabathia2

Copy link
Copy Markdown
Contributor

There was some format issue @eyupcanakman. After fixing this please let me know and I can do the review again 😸

@eyupcanakman

Copy link
Copy Markdown
Contributor Author

That format failure is ruff 0.16.0, which started formatting python code blocks inside .md files. CI installs the newest ruff from the dev extra while pre-commit pins v0.12.8, so the six docs files it flags fail on a clean main too.

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