Class Orthogonal<T extends TFloating>
java.lang.Object
org.tensorflow.framework.initializers.BaseInitializer<T>
org.tensorflow.framework.initializers.Orthogonal<T>
- Type Parameters:
T- The TType for the call operation
- All Implemented Interfaces:
Initializer<T>
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(Ops tf, tf.constant(Shape.of(2,2)), TFloat32.class);
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOrthogonal(double gain, long seed) Creates an Orthogonal InitializerOrthogonal(long seed) Creates an Orthogonal Initializer usingGAIN_DEFAULTfor the gain. -
Method Summary
Methods inherited from class BaseInitializer
getName
-
Field Details
-
GAIN_DEFAULT
public static final double GAIN_DEFAULT- See Also:
-
-
Constructor Details
-
Orthogonal
public Orthogonal(long seed) Creates an Orthogonal Initializer usingGAIN_DEFAULTfor the gain.- Parameters:
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.
-
Orthogonal
public Orthogonal(double gain, long seed) Creates an Orthogonal Initializer- Parameters:
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.
-
-
Method Details
-
call
-