Class Identity<T extends TFloating>

java.lang.Object
org.tensorflow.framework.initializers.BaseInitializer<T>
org.tensorflow.framework.initializers.Identity<T>
Type Parameters:
T - The TType for the call operation
All Implemented Interfaces:
Initializer<T>

public class Identity<T extends TFloating> extends BaseInitializer<T>
Initializer that generates the identity matrix.

Only usable for generating 2D matrices.

Examples:

    Identity<TFloat32> initializer =
            new org.tensorflow.framework.initializers.Identity<>(tf);
    Operand<TFloat32> values =
            initializer.call(Ops tf, tf.constant(Shape.of(2,2)), TFloat32.class);
  • Field Details

  • Constructor Details

    • Identity

      public Identity()
      Creates an Initializer that generates the identity matrix.
    • Identity

      public Identity(double gain)
      Creates an Initializer that generates the identity matrix.
      Parameters:
      gain - the gain to be applied to the Identity Matrix
  • Method Details

    • call

      public Operand<T> call(Ops tf, Operand<TInt64> dims, Class<T> type)
      Generates the operation used to perform the initialization.
      Parameters:
      tf - the TensorFlow Ops
      dims - the shape dimensions
      type - the type of tensor
      Returns:
      An operand for the initialization.