ShapeUtils

public class ShapeUtils

Various methods for processing with Shapes and Operands

Public Constructors

Public Methods

static int[]
getIntArray(Scope scope, Operand<TInt32> dims)
Converts a TInt32 type Operand to a Java int array
static <T extends TIntegral> long[]
getLongArray(T dims)
Converts a TInt32 or TInt64 to a java long array
static <T extends TIntegral> long[]
getLongArray(Scope scope, Operand<T> dims)
Converts a TInt32 or TInt64 Operand to a java long array
static Shape
reduce(Shape shape, int axis)
Reduces the shape by eliminating trailing Dimensions.
static <T extends TIntegral> Shape
toShape(Scope scope, Operand<T> dims)
Converts a shape operand to a Shape object

Inherited Methods

Public Constructors

public ShapeUtils ()

Public Methods

public static int[] getIntArray (Scope scope, Operand<TInt32> dims)

Converts a TInt32 type Operand to a Java int array

Parameters
scope the TensorFlow scope
dims the shape dimensions operand
Returns
  • the int array of the dimensions

public static long[] getLongArray (T dims)

Converts a TInt32 or TInt64 to a java long array

Parameters
dims the dimension tensor
Returns
  • the long array
Throws
IllegalArgumentException if the dims type is not an integer

public static long[] getLongArray (Scope scope, Operand<T> dims)

Converts a TInt32 or TInt64 Operand to a java long array

Parameters
scope the TensorFlow scope
dims the Operand
Returns
  • the long array
Throws
IllegalArgumentException if the dims type is not an integer

public static Shape reduce (Shape shape, int axis)

Reduces the shape by eliminating trailing Dimensions.

The last dimension, specified by axis, will be a product of all remaining dimensions

Parameters
shape the shape to squeeze
axis the axis to squeeze
Returns
  • the new shape

public static Shape toShape (Scope scope, Operand<T> dims)

Converts a shape operand to a Shape object

Parameters
scope the TensorFlow scope
dims the Operand containing the shape values
Returns
  • a new Shape based on an Operand that contains dimensions