Class AbstractConstraint

java.lang.Object
org.tensorflow.framework.constraints.AbstractConstraint
All Implemented Interfaces:
Constraint
Direct Known Subclasses:
MaxNorm, MinMaxNorm, NonNeg, UnitNorm

public abstract class AbstractConstraint extends Object implements Constraint
Base class for Constraints. AbstractConstraint subclasses impose constraints on weight values
  • Field Details

  • Constructor Details

    • AbstractConstraint

      public AbstractConstraint()
      Creates a AbstractConstraint
  • Method Details

    • sqrt

      protected <T extends TNumber> Operand<T> sqrt(Ops tf, Operand<T> x)
      Gets the element-wise square root.
      Type Parameters:
      T - The data type for the operand and result.
      Parameters:
      tf - the TensorFlow Ops
      x - the input Operand.
      Returns:
      the element-wise square root.
      Throws:
      IllegalArgumentException - if x is null
    • clip

      protected <T extends TNumber> Operand<T> clip(Ops tf, Operand<T> x, double minValue, double maxValue)
      Gets the element-wise value clipping.
      Type Parameters:
      T - The data type for the operand and result.
      Parameters:
      tf - the TensorFlow Ops
      x - the Operand to clip
      minValue - the minimum value
      maxValue - the maximum value
      Returns:
      the operand with clipped values
      Throws:
      IllegalArgumentException - if x is null
    • norm

      protected <T extends TNumber> Operand<T> norm(Ops tf, Operand<T> weights, int[] axes)
      Calculates the norm of the weights along the axes
      Type Parameters:
      T - the data type for the weights and the result
      Parameters:
      tf - the TensorFlow Ops
      weights - the weights used to calculate the norms
      axes - the axes along which to calculate weight norms.
      Returns:
      the norms
      Throws:
      IllegalArgumentException - if weights is null