public class Softmax<T extends AbstractFloat = Float> extends Layer<T>
Stable row-wise normalization of finite logits into class probabilities. Use SparseCategoricalCrossentropy(fromLogits=false) after this activation. A loss configured with fromLogits=true instead requires a linear output.
probabilities = Softmax<Float>().forward(model.predict(xTest))
| Modifier and Type | Member | Description |
|---|---|---|
| public override readonly property | displayNamedisplayName as String |
Summary label. |
| public override readonly property | parameterCountparameterCount as ULong |
Softmax has no trainable parameters. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | backwardTrainingbackwardTraining(context as LayerPass<T>, upstream as NDArray<T>) as LayerGradients<T> |
Reuses saved probabilities rather than evaluating exponentials again. |
| public | build | Checks and preserves a positive feature width. |
| public override | buildShape | Validates a vector of class scores. |
| public override | differentiatedifferentiate(inputs as NDArray<T>, upstream as NDArray<T>) as LayerGradients<T> |
Computes a Jacobian-vector product without materializing a Jacobian. |
| public override | forward | Computes exp(x - max(x)) / sum(exp(x - max(x))) along each row. |
| public override | parameter | Rejects parameter access on this parameter-free activation. |