7.3 Sequential Models: nn_squential()
nn_squential()
can be used for models that propagate straight through the layers. A Multi-Layer Perceptron (MLP) is an example (i.e. a network consisting only of linear layers). Below we build an MLP using this method:
mlp <- nn_sequential( # all arguments should be modules
nn_linear(10, 32),
nn_relu(),
nn_linear(32,64),
nn_relu(),
nn_linear(64,1)
)
Apply this model to random data: