Skip to contents

Fills the input Tensor with a (semi) orthogonal matrix, as described in Exact solutions to the nonlinear dynamics of learning in deep linear neural networks - Saxe, A. et al. (2013). The input tensor must have at least 2 dimensions, and for tensors with more than 2 dimensions the trailing dimensions are flattened.

Usage

nn_init_orthogonal_(tensor, gain = 1)

Arguments

tensor

an n-dimensional Tensor

gain

optional scaling factor

Examples

if (torch_is_installed()) {
w <- torch_empty(3, 5)
nn_init_orthogonal_(w)
}
#> torch_tensor
#> -0.8132 -0.4735 -0.2453  0.2239 -0.0644
#> -0.3553  0.3541  0.2067 -0.5077 -0.6693
#> -0.2256 -0.1611  0.8812 -0.0873  0.3729
#> [ CPUFloatType{3,5} ]