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.1160 -0.2048 -0.9706  0.0430  0.0257
#> -0.7007  0.1632 -0.0854  0.4108  0.5535
#>  0.0030  0.3251 -0.0535  0.7074 -0.6253
#> [ CPUFloatType{3,5} ]