tests/testthat/helper_module.R

testmodule_linear = nn_module(
  initialize = function(task) {
    out = output_dim_for(task)
    self$linear = nn_linear(length(task$feature_names), out)
  },
  forward = function(x) {
    self$linear(x)
  }
)

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.