mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-21 17:57:24 -05:00
Closed
opened 2026-04-11 08:04:27 -05:00 by GiteaMirror
·
1 comment
No Branch/Tag Specified
dev
audit/mlperf-edu-readiness
feat/mlperf-edu-precondition
gh-pages
vol1/all-final
main
vol1/appendices-final
vol1/ch16-final
vol1/ch15-final
vol1/ch14-final
vol1/ch13-final
vol1/ch11-final
vol1/ch12-final
vol1/ch10-final
vol1/ch9-final
vol1/ch8-final
vol1/ch7-final
vol1/ch6-final
vol1/ch5-final
vol1/ch4-final
vol1/ch3-final
vol1/ch2-final
vol1/frontmater-final
kai/fixing-profile-setting-and-map
chore/staffml-ci-path
fix/callout-flow
vol1/ch10-pass4
vol1/ch9-pass4
vol1/ch8-pass4
vol1/ch7-pass4
vol1/ch6-pass4
vol1/ch5-pass4
vol1/apC-pass3
vol1/ch4-pass4
vol1/ch3-pass4
vol1/ch2-pass4
vol1/ch1-pass4
vol1/frontmatter
vol1/apE-pass3
vol1/apD-pass3
fmt-fix
vol1/ch14-pass3
kai/clarify-community-map-totals
vol1/ch13-pass3
vol1/ch12-pass3
vol1/ch11-pass3
vol1/ch10-pass3
vol1/ch7-pass3
vol1/ch9-pass3
vol1/ch8-pass3
vol1/ch6-pass3
vol1/ch5-pass3
vol1/ch4-pass3
vol1/ch3-pass3
vol1/ch2-pass3
vol1/ch1-pass3
vol1/ch6-pass2
vol1/ch5-pass2
vol1/ch4-pass2
vol1/ch3-pass2
vol1/ch2-pass2
fix/badge-fixes
chore/precommit-cleanup
cleanup/book-validate-paths
fix/staffml-trigger-on-workflow-edits
fix/staffml-reusable-concurrency
feat/container-preflight-urls
instructors-v0.1.1
vol1-pr1957-merged
vol2-v0.2.1
vol1-v0.7.1
vol1-v0.7.0+vol2-v0.2.0
slides-v0.1.0
vol2-v0.2.0
vol1-v0.7.0
tinytorch-v0.1.13
mlsysim-v0.2.0
vol2-v0.1.2
vol1-v0.6.2
tinytorch-v0.1.12
vol2-v0.1.1
vol1-v0.6.1
mlsysim-v0.1.3
vol2-v0.1.0
vol1-v0.6.0
mlsysim-v0.1.2
staffml-v0.1.1
tinytorch-v0.1.11
labs-v0.1.0
kits-v0.1.0
slides-latest
instructors-v0.1.0
staffml-v0.1.0
mlsysim-v0.1.1
mlsysim-v0.1.0
tinytorch-v0.1.10
build-verified-windows-v1
tinytorch-v0.1.9
tinytorch-v0.1.8
mit-submission-v1
tinytorch-v0.1.7
tinytorch-v0.1.6
tinytorch-v0.1.5
tinytorch-slides-v0.1.0
tinytorch-v0.1.3
tinytorch-v0.1.4
tinytorch-v0.1.2
tinytorch-v0.1.1
tinytorch-v0.1.0
book-v0.5.1
tinytorch-audio-v0.1.1
tinytorch-audio-assets-v0.1
book-v0.5.0
book-v0.4.2
book-v0.4.1
book-v0.4.0
book-v0.3.0
book-v0.2.0
book-v0.1.0
Labels
Clear labels
area: book
area: collabs
area: kits
area: labs
area: socratiq
area: staffml
area: tinytorch
area: tools
area: website
bug
dependencies
format: epub
format: pdf
javascript
link-health
link-rot
priority-high
pull-request
staffml
type: bug
type: citation
type: code
type: errata
type: improvement
type: new
type: question
vault-sli
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/cs249r_book#1713
Reference in New Issue
Block a user
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.
Originally created by @minhdang26403 on GitHub (Feb 6, 2026).
Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/1164
In the Module 03 - Layers, there are some inconsistencies between code examples. Specifically, in the Linear layer implementation, the book mentions
requires_gradparameter, but it's not set in the code.However, in the forward pass of
Dropout, the code creates Tensor and setsrequires_gradparameter. This can cause some confusion while reading the book.Therefore, I raise this issue to have a discussion about whether we should explicitly set
requires_gradparameters here. Once we have an agreement on this, I can create PR to fix this issue.@profvjreddi commented on GitHub (Feb 6, 2026):
Hi @minhdang26403! 👋 Thank you for the careful review of Module 03! You have a great eye for consistency issues.
The good news is that this was already fixed on in commit a363406 ("fix(layers): remove requires_grad from Linear layer Tensor calls").
The code examples you're seeing with requires_grad=x.requires_grad and requires_grad=False are from an older version. The current implementation in main has neither Linear nor Dropout using requires_grad:
Current Linear layer:
self.weight = Tensor(weight_data) # No requires_grad
self.bias = Tensor(bias_data) # No requires_grad
Current Dropout layer:
mask_tensor = Tensor(mask.astype(np.float32)) # No requires_grad
scale = Tensor(np.array(1.0 / keep_prob)) # No requires_grad
This was a bug and has been fixed, and now it is intentional, as TinyTorch follows progressive disclosure—Module 03 teaches layers, but requires_grad isn't introduced until Module 06 (Autograd). This prevents students from encountering concepts before they've been explained. Since you're looking at an older cached or forked version, I'll close this issue as already resolved. But thank you again for the thorough review 🙏