Both NumPy and PyTorch do not allow operands of the matmul operation to be 0D tensors. To make TinyTorch achieve the same functionality as PyTorch, the method matmul should raise error when it receives a 0D tensor. For 0D tensor multiplication, users should use element-wise multiplication *.
All Tensor module tests pass and there is no regression.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1119
**Author:** [@minhdang26403](https://github.com/minhdang26403)
**Created:** 1/20/2026
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `fix/tensor-matmul`
---
### 📝 Commits (2)
- [`cfd5449`](https://github.com/harvard-edge/cs249r_book/commit/cfd5449df9a7fa2695a8dbb5489efabac18ac5df) fix: fix memory calculation result
- [`8f387b9`](https://github.com/harvard-edge/cs249r_book/commit/8f387b915e870c15c0842c359ee612663db84812) fix: matmul should not allow 0D tensors
### 📊 Changes
**2 files changed** (+10 additions, -12 deletions)
<details>
<summary>View changed files</summary>
📝 `tinytorch/src/01_tensor/01_tensor.py` (+9 -11)
📝 `tinytorch/src/01_tensor/ABOUT.md` (+1 -1)
</details>
### 📄 Description
Both NumPy and PyTorch do not allow operands of the matmul operation to be 0D tensors. To make TinyTorch achieve the same functionality as PyTorch, the method matmul should raise error when it receives a 0D tensor. For 0D tensor multiplication, users should use element-wise multiplication `*`.
All Tensor module tests pass and there is no regression.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1119
Author: @minhdang26403
Created: 1/20/2026
Status: ❌ Closed
Base:
dev← Head:fix/tensor-matmul📝 Commits (2)
cfd5449fix: fix memory calculation result8f387b9fix: matmul should not allow 0D tensors📊 Changes
2 files changed (+10 additions, -12 deletions)
View changed files
📝
tinytorch/src/01_tensor/01_tensor.py(+9 -11)📝
tinytorch/src/01_tensor/ABOUT.md(+1 -1)📄 Description
Both NumPy and PyTorch do not allow operands of the matmul operation to be 0D tensors. To make TinyTorch achieve the same functionality as PyTorch, the method matmul should raise error when it receives a 0D tensor. For 0D tensor multiplication, users should use element-wise multiplication
*.All Tensor module tests pass and there is no regression.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.