0Pricing
Deep Learning Academy · Lektion

Forward-Pass, Loss, Backward, Step

Die vier Schritte einer Trainingsiteration.

Forward-Pass, Loss, Backward, Step ist eine kostenlose Deep Learning Academy-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Deep Learning Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Deep Learning Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Four Moves, One Beat

Every training iteration is just four moves repeated: forward, loss, backward, step. Learn this rhythm and the whole training loop stops feeling mysterious. 🥁

Move One: Forward

The forward pass sends your input through the model so it produces a prediction. You just call the model on a batch of data and read the output.

pred = model(x)

Logits, Not Answers Yet

The forward output is usually raw scores called logits, not clean labels. The loss function knows how to read these scores directly, so you leave them as is.

Move Two: Loss

Next you measure how wrong the prediction was. The loss compares your output to the true labels and boils the mistake down to one number.

loss = loss_fn(pred, y)

Lower Loss, Better Model

A big loss means a poor prediction and a small one means a good prediction. Training has a single mission: drive this number steadily downward.

Move Three: Backward

Now you ask which way to nudge each weight. The backward pass uses autograd to compute every gradient and fill each parameter's .grad for you.

loss.backward()

Gradients Are Directions

Each gradient tells you how the loss would change if you tweaked that one weight. They are the map the optimizer follows toward a better model.

Move Four: Step

Finally the optimizer applies those gradients, nudging every weight a little. This step is the moment the model actually learns from its mistake.

optimizer.step()

Clear the Grads

Gradients pile up by default, so before the next backward you call zero_grad. Skip it and old gradients corrupt your next update.

optimizer.zero_grad()

The Whole Move

Put the four moves together and you get one clean iteration. You will type this exact pattern in nearly every PyTorch project you build.

optimizer.zero_grad()
pred = model(x)
loss = loss_fn(pred, y)
loss.backward()
optimizer.step()

Then Do It Again

Run these moves on batch after batch and the loss falls a little each time. Thousands of tiny updates are what turn random weights into real skill.

Quick Check

Which call actually computes the gradients for every weight?

Recap

One iteration is four moves: forward for a prediction, loss to measure error, backward for gradients, and step to update weights. Repeat to learn. 🎉

Häufig gestellte Fragen

Ist die Lektion „Forward-Pass, Loss, Backward, Step“ kostenlos?

Ja — der vollständige Text von „Forward-Pass, Loss, Backward, Step“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Deep Learning Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Deep Learning Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Forward-Pass, Loss, Backward, Step“?

Die vier Schritte einer Trainingsiteration. Du übst Deep Learning Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Deep Learning Academy zu starten?

Keine Vorkenntnisse erforderlich. Deep Learning Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.

Wie lange dauert die Lektion „Forward-Pass, Loss, Backward, Step“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Deep Learning Academy-Lektion Code schreiben und ausführen?

Ja. Jede Deep Learning Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Forward-Pass, Loss, Backward, Step
  2. Eine minimale Trainingsschleife schreiben
  3. Genauigkeit während des Trainings verfolgen
  4. Trainings- und Evaluationsmodus
← Zurück zu Deep Learning Academy