If the shape of the tensor to initialize is two-dimensional, it is initialized with an orthogonal matrix obtained from the QR decomposition of a matrix of random numbers drawn from a normal distribution. If the matrix has fewer rows than columns then the output will have orthogonal rows. Otherwise, the output will have orthogonal columns.
If the shape of the tensor to initialize is more than two-dimensional,
a matrix of shape (shape[1] * ... * shape[n - 1], shape[n])
is initialized, where n
is the length of the shape vector.
The matrix is subsequently reshaped to give a tensor of the desired shape.
initializer_orthogonal(gain = 1, seed = NULL)
An Initializer
instance that can be passed to layer or variable
constructors, or called directly with a shape
to return a Tensor.
Multiplicative factor to apply to the orthogonal matrix.
An integer. Used to make the behavior of the initializer deterministic.
# Standalone usage:
initializer <- initializer_orthogonal()
values <- initializer(shape = c(2, 2))
# Usage in a Keras layer:
initializer <- initializer_orthogonal()
layer <- layer_dense(units = 3, kernel_initializer = initializer)
Other random initializers:
initializer_glorot_normal()
initializer_glorot_uniform()
initializer_he_normal()
initializer_he_uniform()
initializer_lecun_normal()
initializer_lecun_uniform()
initializer_random_normal()
initializer_random_uniform()
initializer_truncated_normal()
initializer_variance_scaling()
Other initializers:
initializer_constant()
initializer_glorot_normal()
initializer_glorot_uniform()
initializer_he_normal()
initializer_he_uniform()
initializer_identity()
initializer_lecun_normal()
initializer_lecun_uniform()
initializer_ones()
initializer_random_normal()
initializer_random_uniform()
initializer_stft()
initializer_truncated_normal()
initializer_variance_scaling()
initializer_zeros()