TensorLearn
Back to Course
Neural Networks: From Scratch
Module 7 of 12

7. The Training Loop

1. The Cycle of Life

  1. Forward: Pass data through network -> Get Prediction.
  2. Loss: Compare Prediction vs Truth. [Current Error: 0.5]
  3. Backward: Calculate Gradients. [Blame w1: +0.2]
  4. Step: Update Weights. [w1 = w1 - 0.01 * 0.2]
  5. Zero Grad: Clear gradients for next step.
python
for epoch in range(100): pred = model.forward(x) loss = mse(pred, y) loss.backward() # Magic happens here optimizer.step() optimizer.zero_grad()

Mark as Completed

TensorLearn - AI Engineering for Professionals