mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-16 23:24:55 -05:00
Merge pull request #1617 from harvard-edge/fix/perceptron-seed
fix(tinytorch): perceptron weights deterministic across runs (#1611)
This commit is contained in:
@@ -85,7 +85,9 @@ This milestone shows you WHY training is essential - the model won't work withou
|
||||
import sys
|
||||
import os
|
||||
import numpy as np
|
||||
rng = np.random.default_rng(7)
|
||||
# Unseeded RNG: each run draws different cluster points so the demo lives up
|
||||
# to the on-screen "No random seed - each run will be different!" promise.
|
||||
rng = np.random.default_rng()
|
||||
import argparse
|
||||
|
||||
# Add project root to path for correct tinytorch imports
|
||||
|
||||
@@ -62,7 +62,10 @@ from tinytorch.core.activations import ReLU, Sigmoid # Module 02 - intelligence
|
||||
#| export
|
||||
|
||||
import numpy as np
|
||||
rng = np.random.default_rng(7)
|
||||
# Module-level RNG is intentionally UNSEEDED so freshly-constructed layers
|
||||
# (e.g., Linear) produce different weights on every run. Tests/demos that
|
||||
# need determinism create their own seeded RNG locally (see below).
|
||||
rng = np.random.default_rng()
|
||||
|
||||
# Import from TinyTorch package (previous modules must be completed and exported)
|
||||
from tinytorch.core.tensor import Tensor
|
||||
|
||||
Reference in New Issue
Block a user