0Pricing
Deep Learning Academy · Lektion

Matrixmultiplikation mit matmul und @

Die Skalarprodukte hinter jeder Schicht.

Matrixmultiplikation mit matmul und @ ist eine kostenlose Deep Learning Academy-Lektion auf CoddyKit. Dies ist Lektion 3 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.

Beyond Elementwise

Multiplying tensors with the star sign is elementwise. Matrix multiplication is different: it mixes rows and columns into weighted sums.

Dot Products in Bulk

Each output entry of a matrix multiply is a dot product: one row of the left matrix paired with one column of the right matrix.

The Inner Dimensions Must Match

To multiply shapes (m, k) and (k, n), the inner k must agree. The result is (m, n): outer dimensions survive, the inner one is summed away.

The @ Operator

Python gives matrix multiply its own clean symbol. The @ operator multiplies two tensors the matrix way, no loops in sight.

c = a @ b

torch.matmul Does the Same

torch.matmul is the spelled-out twin of @. Same result, handy when you prefer a named function call in your code.

c = torch.matmul(a, b)

Mind the Shapes

A (2, 3) times a (3, 4) gives a (2, 4). Read the shapes left to right and the inner 3 cancels, leaving the outer pair.

a = torch.randn(2, 3)
b = torch.randn(3, 4)
c = a @ b  # shape (2, 4)

Star Is Not At

Do not confuse them: a * b is elementwise and needs matching shapes, while a @ b is matrix multiply and needs matching inner dimensions.

Matrix Times Vector

Multiply a matrix by a 1D vector and you get a vector. Each output number is the dot product of a matrix row with that vector.

y = W @ x  # W is (n, m), x is (m,), y is (n,)

Batched matmul

matmul handles batches: feed shapes (B, m, k) and (B, k, n) and it multiplies each of the B matrix pairs at once, returning (B, m, n).

out = torch.matmul(batch_a, batch_b)

Shape Errors Are Loud

Mismatch the inner dimensions and PyTorch throws a clear RuntimeError. Reading those shape messages quickly becomes your fastest debugging tool.

The Engine of Every Layer

This one operation is everywhere. A linear layer is just inputs times a weight matrix plus a bias, and matmul does that heavy lifting.

out = x @ W.T + bias

Quick Check

Time to check your shape arithmetic.

Recap: Rows Meet Columns

Matrix multiply with @ or torch.matmul pairs rows with columns into dot products; inner dimensions must match, outer ones survive. It powers every layer. 🔗

Häufig gestellte Fragen

Ist die Lektion „Matrixmultiplikation mit matmul und @“ kostenlos?

Ja — der vollständige Text von „Matrixmultiplikation mit matmul und @“ 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 „Matrixmultiplikation mit matmul und @“?

Die Skalarprodukte hinter jeder Schicht. 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 3 von 4.

Wie lange dauert die Lektion „Matrixmultiplikation mit matmul und @“?

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. Warum Schleifen bei Berechnungen langsam sind
  2. Elementweise Operationen und Reduktionen
  3. Matrixmultiplikation mit matmul und @
  4. Skalarprodukte treiben jede Schicht an
← Zurück zu Deep Learning Academy