Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nn_module_list

Holds submodules in a list.


Description

nn_module_list can be indexed like a regular R list, but modules it contains are properly registered, and will be visible by all nn_module methods.

Usage

nn_module_list(modules = list())

Arguments

modules

a list of modules to add

Examples

if (torch_is_installed()) {

my_module <- nn_module(
 initialize = function() {
   self$linears <- nn_module_list(lapply(1:10, function(x) nn_linear(10, 10)))
 },
 forward = function(x) {
  for (i in 1:length(self$linears))
    x <- self$linears[[i]](x)
  x
 }
)

}

torch

Tensors and Neural Networks with 'GPU' Acceleration

v0.3.0
MIT + file LICENSE
Authors
Daniel Falbel [aut, cre, cph], Javier Luraschi [aut], Dmitriy Selivanov [ctb], Athos Damiani [ctb], Christophe Regouby [ctb], Krzysztof Joachimiak [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.