Initializer that generates an orthogonal matrix.
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.size(0) * ... * shape.size(n - 2), shape.size(n - 1))
is initialized, where
n
is the length of the shape vector. The matrix is subsequently reshaped to give a
tensor of the desired shape.
Examples:
Orthogonal<TFloat32, TFloat32> initializer = new org.tensorflow.framework.initializers.Orthogonal<>(tf); Operand<TFloat32> values = initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);
Constants
double | GAIN_DEFAULT |
Public Constructors
Orthogonal(Ops tf, long seed)
Creates an Orthogonal Initializer using
GAIN_DEFAULT for the gain. |
|
Orthogonal(Ops tf, double gain, long seed)
Creates an Orthogonal Initializer
|
Public Methods
Operand<T> |
Inherited Methods
Constants
public static final double GAIN_DEFAULT
Public Constructors
public Orthogonal (Ops tf, long seed)
Creates an Orthogonal Initializer using GAIN_DEFAULT
for the gain.
Parameters
tf | the TensorFlow Ops |
---|---|
seed | the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype. |
public Orthogonal (Ops tf, double gain, long seed)
Creates an Orthogonal Initializer
Parameters
tf | the TensorFlow Ops |
---|---|
gain | the gain to be applied to the Matrix. |
seed | the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype. |