mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-16 06:07:17 -05:00
[GH-ISSUE #1893] [Bug] Jupyternotebook: Tensor.__init__() Does Not Accept requires_grad Used by Autograd Tests #29768
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Chufeng-Jiang on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/1893
Area
TinyTorch
Location
Module 06 and forward in the jupyternotebook
Description
The autograd broadcasting tests construct tensors using the following syntax:
x = Tensor(data, requires_grad=True)
However, the currently exported Tensor class only defines:
Tensor(data)
As a result, the tests in the Jupyternotebook fail before reaching the broadcasting-gradient implementation.
However, it doesn't affect the unit test when call "tito module complete 06", everything passed successfully.
Expected Behavior
I think all related - codes in the notebook cell needs to revised to, making the requires_grad separately :
The same change may need to be applied to the other occurrences of Tensor(..., requires_grad=True) in the cell.
I would be happy to submit a pull request with the modifications in the cell. However, before doing so, I wanted to confirm whether this is the intended fix or whether the Tensor constructor is instead supposed to be updated to support the requires_grad argument.
Environment (TinyTorch bugs only)
No response