| ag_linear | R Documentation |
Returns a closure-based layer. Because ag_param uses environment semantics, the optimizer updates W and b in-place, and forward() always uses the latest weights.
ag_linear(
in_features,
out_features,
activation = NULL,
init = "glorot_uniform",
gain = 1
)
in_features |
Input dimension |
out_features |
Output dimension |
activation |
"relu", "sigmoid", "tanh", "softmax", or NULL |
init |
Weight initialisation,
The bias always starts at zero. |
gain |
Multiplier for the string initialisations (e.g. |
List with W, b, forward(x), params()
layer <- ag_linear(4L, 8L, activation = "relu")
x <- ag_tensor(matrix(runif(4 * 16), 4, 16))
out <- layer$forward(x)
head <- ag_linear(8L, 2L, init = "orthogonal", gain = 0.01)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.