# \donttest{
ln <- ag_layer_norm(4L)
x <- ag_param(matrix(rnorm(8), 4, 2)) # [features, batch]
with_grad_tape({
y <- ln$forward(x)
loss <- ag_mse_loss(y, matrix(0, 4, 2))
})
grads <- backward(loss)
# }
Run the code above in your browser using DataLab