R/nn.R

Defines functions nn

Documented in nn

#' @title Create a Neural Network Layer
#' @description
#' Retrieve a neural network layer from the
#' [`mlr_pipeops`][mlr3pipelines::mlr_pipeops] dictionary.
#' @param .key (`character(1)`)\cr
#' @param ... (any)\cr
#'   Additional parameters, constructor arguments or fields.
#' @export
#' @examples
#' po1 = po("nn_linear", id = "linear")
#' # is the same as:
#' po2 = nn("linear")
nn = function(.key, ...) {
  args = list(...)
  if (is.null(args$id)) {
    args$id = .key
  }
  invoke(po, .obj = paste0("nn_", .key), .args = args)
}

Try the mlr3torch package in your browser

Any scripts or data that you put into this service are public.

mlr3torch documentation built on Aug. 26, 2025, 5:09 p.m.