mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-11 00:49:12 -05:00
[PR #1695] fix(tinytorch): reuse Sigmoid class in GELU solution #10237
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?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1695
Author: @Shashank-Tripathi-07
Created: 5/7/2026
Status: 🔄 Open
Base:
dev← Head:fix/tinytorch-gelu-reuse-sigmoid📝 Commits (1)
4257203fix(tinytorch): reuse Sigmoid class in GELU solution📊 Changes
1 file changed (+1 additions, -6 deletions)
View changed files
📝
tinytorch/src/02_activations/02_activations.py(+1 -6)📄 Description
Summary
forward()solution used rawnp.expto compute the sigmoid, bypassing theSigmoidclass students built earlier in the same module.return Sigmoid()(x * 1.702) * x, which is numerically identical and demonstrates class composition.Fix
Before:
After:
Verified numerically: both produce identical outputs across positive and negative inputs.
Fixes #1692
Test plan
np.allclose(Sigmoid()(x * 1.702) * x, old_impl(x))passes for representative inputspytest tests/tito src export 02_activationsand confirm the student-facing cell is still a blank stub🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.