[PR #1123] [MERGED] Remove unused next_functions from Function class #3076

Closed
opened 2026-04-13 13:21:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 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: devHead: fix/1122-remove-unused-next-functions


📝 Commits (1)

  • 0497d10 Remove 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

  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

🔄 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>
GiteaMirror added the pull-request label 2026-04-13 13:21:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#3076