MetricsHelper

public class MetricsHelper

These are helper methods for Metrics and will be module private when Java modularity is applied to TensorFlow Java. These methods should not be used outside of the metrics packages.

Constants

float NEG_INF

Public Constructors

Public Methods

static <T extends TNumber> Op
assertBroadcastable(Ops tf, Operand<T> sampleWeights, Operand<T> values)
Asserts that the sampleWeights can be broadcast to the same shape as values

In losses and metrics, limited weight broadcasting is supported.

static Operand<TFloat64>
booleanMean(Ops tf, Operand<TBool> x)
Calculate the mean of the operand, along all axes and keepDims is false
static Operand<TFloat64>
booleanMean(Ops tf, Operand<TBool> x, boolean keepDims)
Calculates the mean of the boolean operand, alongside all axes.
static Operand<TFloat64>
booleanMean(Ops tf, Operand<TBool> x, Operand<? extends TIntegral> axes)
Calculate the mean of the operand, alongside the specified axis with keepDims is false
static Operand<TFloat64>
booleanMean(Ops tf, Operand<TBool> x, Operand<? extends TIntegral> axes, boolean keepDims)
Calculates the mean of the boolean operand, alongside the specified axes.
static <T extends TNumber> Operand<T>
broadcastWeights(Ops tf, Operand<T> weights, Operand<T> values)
Broadcast weights to the same shape as values.
static <T extends TNumber> Operand<T>
mean(Ops tf, Operand<T> x)
Calculate the mean of the operand, along all axes and keepDims is false
static <T extends TNumber> Operand<T>
mean(Ops tf, Operand<T> x, Operand<? extends TIntegral> axes)
Calculate the mean of the operand, alongside the specified axis with keepDims is false
static <T extends TNumber> Operand<T>
mean(Ops tf, Operand<T> x, Operand<? extends TIntegral> axes, boolean keepDims)
Calculates the mean of the operand, alongside the specified axes.
static <T extends TNumber> Operand<T>
mean(Ops tf, Operand<T> x, boolean keepDims)
Calculates the mean of the operand, along all axes.

Inherited Methods

Constants

public static final float NEG_INF

Constant Value: -1.0E10

Public Constructors

public MetricsHelper ()

Public Methods

public static Op assertBroadcastable (Ops tf, Operand<T> sampleWeights, Operand<T> values)

Asserts that the sampleWeights can be broadcast to the same shape as values

In losses and metrics, limited weight broadcasting is supported. Weights must be either scalar, or the same rank as the target values, with each dimension either 1, or the same as the corresponding values dimension.

Parameters
tf the TensorFlow Ops
sampleWeights the sample weights.
values the values to which weights are applied.
Returns
  • Operation with control dependencies to ensure sampleWeight can be broadcast to values
Throws
NotBroadcastableException If static checks determine sampleWeights has an incorrect shape that prohibit broadcasting to values

public static Operand<TFloat64> booleanMean (Ops tf, Operand<TBool> x)

Calculate the mean of the operand, along all axes and keepDims is false

Parameters
tf the TensorFlow Ops
x the Operand used to calculate the mean
Returns
  • the mean of the operand containing floating point numbers

public static Operand<TFloat64> booleanMean (Ops tf, Operand<TBool> x, boolean keepDims)

Calculates the mean of the boolean operand, alongside all axes.

Parameters
tf the TensorFlow Ops
x the boolean Operand used to calculate the mean
keepDims Indicates whether to keep the dimensions or not. If keepdims is false, the rank of the tensor is reduced by 1 for each entry in axes . If keepdims is true, the reduced dimensions are retained with length 1.
Returns
  • the mean of elements of x containing floating point numbers

public static Operand<TFloat64> booleanMean (Ops tf, Operand<TBool> x, Operand<? extends TIntegral> axes)

Calculate the mean of the operand, alongside the specified axis with keepDims is false

Parameters
tf the TensorFlow Ops
x the Operand used to calculate the mean
axes Axes to compute the mean.
Returns
  • the mean of the operand, along the specified axes, containing floating point numbers

public static Operand<TFloat64> booleanMean (Ops tf, Operand<TBool> x, Operand<? extends TIntegral> axes, boolean keepDims)

Calculates the mean of the boolean operand, alongside the specified axes.

Parameters
tf the TensorFlow Ops
x the boolean Operand used to calculate the mean
axes Axes to compute the mean.
keepDims Indicates whether to keep the dimensions or not. If keepdims is false, the rank of the tensor is reduced by 1 for each entry in axes . If keepdims is true, the reduced dimensions are retained with length 1.
Returns
  • the mean of elements of x containing floating point numbers

public static Operand<T> broadcastWeights (Ops tf, Operand<T> weights, Operand<T> values)

Broadcast weights to the same shape as values.

Parameters
tf the TensorFlow ops
weights Operand whose shape is broadcastable to values.
values Operand of any shape
Returns
  • weights broadcast to values shape

public static Operand<T> mean (Ops tf, Operand<T> x)

Calculate the mean of the operand, along all axes and keepDims is false

Parameters
tf the TensorFlow Ops
x the Operand used to calculate the mean
Returns
  • the mean of the operand

public static Operand<T> mean (Ops tf, Operand<T> x, Operand<? extends TIntegral> axes)

Calculate the mean of the operand, alongside the specified axis with keepDims is false

Parameters
tf the TensorFlow Ops
x the Operand used to calculate the mean
axes Axes to compute the mean.
Returns
  • the mean of the operand, along the specified axes.

public static Operand<T> mean (Ops tf, Operand<T> x, Operand<? extends TIntegral> axes, boolean keepDims)

Calculates the mean of the operand, alongside the specified axes.

Parameters
tf the TensorFlow Ops
x the Operand used to calculate the mean
axes Axes to compute the mean.
keepDims Indicates whether to keep the dimensions or not. If keepdims is false, the rank of the tensor is reduced by 1 for each entry in axes . If keepdims is true, the reduced dimensions are retained with length 1.
Returns
  • the mean of elements of x.

public static Operand<T> mean (Ops tf, Operand<T> x, boolean keepDims)

Calculates the mean of the operand, along all axes.

Parameters
tf the TensorFlow Ops
x the Operand used to calculate the mean
keepDims Indicates whether to keep the dimensions or not. If keepdims is false, the rank of the tensor is reduced by 1 for each entry in axes . If keepdims is true, the reduced dimensions are retained with length 1.
Returns
  • the mean of elements of x.