nn_init_eye_: Eye initialization

View source: R/nn-init.R

nn_init_eye_R Documentation

Eye initialization

Description

Fills the 2-dimensional input Tensor with the identity matrix. Preserves the identity of the inputs in Linear layers, where as many inputs are preserved as possible.

Usage

nn_init_eye_(tensor)

Arguments

tensor

a 2-dimensional torch tensor.

Examples

if (torch_is_installed()) {
w <- torch_empty(3, 5)
nn_init_eye_(w)
}

torch documentation built on June 7, 2023, 6:19 p.m.