clone_module: Clone a torch module.

View source: R/nn.R

clone_moduleR Documentation

Clone a torch module.

Description

Clones a module.

Usage

clone_module(module, deep = FALSE, ..., replace_values = TRUE)

Arguments

module

(nn_module)
The module to clone

deep

(logical(1))
Whether to create a deep clone.

...

(any)
Additional parameters, currently unused.

replace_values

(logical(1))
Whether to replace parameters and buffers with the cloned values.

Examples

if (torch_is_installed()) {
clone_module(nn_linear(1, 1), deep = TRUE)
# is the same as
nn_linear(1, 1)$clone(deep = TRUE)
}

torch documentation built on May 29, 2024, 9:54 a.m.