nn: Create a Neural Network Layer

View source: R/nn.R

nnR Documentation

Create a Neural Network Layer

Description

Retrieve a neural network layer from the mlr_pipeops dictionary.

The id of the returned PipeOp is .key. Because the ids within a Graph must be unique, .key can be suffixed with ⁠_<n>⁠ to disambiguate repeated layers, e.g. nn("linear_1") and nn("linear_2").

Usage

nn(.key, ...)

Arguments

.key

(character(1))
The key of the layer in the dictionary, optionally followed by a ⁠_<n>⁠ suffix.

...

(any)
Additional parameters, constructor arguments or fields.

Examples

po1 = po("nn_linear", id = "linear")
# is the same as:
po2 = nn("linear")

# the `_<n>` suffix is part of the id, but not of the dictionary key
nn("linear_1")$id

mlr3torch documentation built on Oct. 30, 2026, 5:10 p.m.