-
Notifications
You must be signed in to change notification settings - Fork 0
layer backward
GitHub Action edited this page Jul 9, 2026
·
1 revision
std::pair<utility::matrix, std::pair<utility::matrix, utility::matrix>> backward(utility::matrix dZ)Calculates the gradients for the weights and biases, as well as the gradient matrix to be passed back.
Returns std::pair<utility::matrix, std::pair<utility::matrix, utility::matrix>>
backward(dZ).first is the gradient to be passed backwards, backward(dZ).second.first is the gradient for the weights, and backward(dZ).second.second is the gradient for the biases.
| Parameter | Type | Use | Optional |
|---|---|---|---|
dZ |
utility::matrix |
Gradient matrix | ❌ |
// Calling the backward() function
utility::matrix dZ;
layer l(42, 420);
l.backward(dZ);- AIUsage
- Block
- Embedder
- Introduction
- Layer
- Model
- NeuralNetwork
- PositionalEncoding
- SelfAttention
- Tokenizer
- Utility