Removes the unused next_functions attribute from the Function class in the autograd module. This attribute was declared and populated but never actually used in the backward pass.
Context
This addresses the question raised in #1122 by @AmirAlasady, who correctly identified that self.next_functions is declared but never used. The backward() method uses saved_tensors directly to propagate gradients, making next_functions dead code.
Why remove it
Reduces confusion for students trying to understand the code
The recursive backward approach using saved_tensors is simpler to follow
The docstring incorrectly listed next_functions as a key concept
Testing
All 9 tests in tests/06_autograd/test_autograd_core.py pass
Integration test passes
🔄 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/1123
**Author:** [@profvjreddi](https://github.com/profvjreddi)
**Created:** 1/20/2026
**Status:** ✅ Merged
**Merged:** 1/20/2026
**Merged by:** [@profvjreddi](https://github.com/profvjreddi)
**Base:** `dev` ← **Head:** `fix/1122-remove-unused-next-functions`
---
### 📝 Commits (1)
- [`0497d10`](https://github.com/harvard-edge/cs249r_book/commit/0497d10a64a35300fa93b6af1036707fbc9fce0c) Remove unused next_functions from Function class
### 📊 Changes
**1 file changed** (+0 additions, -10 deletions)
<details>
<summary>View changed files</summary>
📝 `tinytorch/src/06_autograd/06_autograd.py` (+0 -10)
</details>
### 📄 Description
## Summary
Removes the unused next_functions attribute from the Function class in the autograd module. This attribute was declared and populated but never actually used in the backward pass.
## Context
This addresses the question raised in #1122 by @AmirAlasady, who correctly identified that self.next_functions is declared but never used. The backward() method uses saved_tensors directly to propagate gradients, making next_functions dead code.
## Why remove it
1. Reduces confusion for students trying to understand the code
2. The recursive backward approach using saved_tensors is simpler to follow
3. The docstring incorrectly listed next_functions as a key concept
## Testing
- All 9 tests in tests/06_autograd/test_autograd_core.py pass
- Integration test passes
---
<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/1123
Author: @profvjreddi
Created: 1/20/2026
Status: ✅ Merged
Merged: 1/20/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/1122-remove-unused-next-functions📝 Commits (1)
0497d10Remove unused next_functions from Function class📊 Changes
1 file changed (+0 additions, -10 deletions)
View changed files
📝
tinytorch/src/06_autograd/06_autograd.py(+0 -10)📄 Description
Summary
Removes the unused next_functions attribute from the Function class in the autograd module. This attribute was declared and populated but never actually used in the backward pass.
Context
This addresses the question raised in #1122 by @AmirAlasady, who correctly identified that self.next_functions is declared but never used. The backward() method uses saved_tensors directly to propagate gradients, making next_functions dead code.
Why remove it
Testing
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.