Class Shape
java.lang.Object
ai.beestream.jitnn.Shape
An immutable, row-major tensor shape. A rank-0 shape is a scalar with one element.
-
Method Summary
Modifier and TypeMethodDescriptionintaxis(int axis) Normalises a possibly negative axis to[0, rank).static ShapeNumPy broadcasting of two shapes.int[]broadcastStrides(Shape target) Strides for reading a tensor of this shape as if it had shapetarget: broadcast dimensions get stride 0.intdim(int axis) Dimensionaxis; negative values count from the end.int[]dims()A copy of the sizes.booleaninthashCode()intnumel()The number of elements: the product of the sizes (1 for a scalar).static Shapeof(int... dims) The shape with the given sizes (the array is copied).intrank()The number of axes.reduce(int axis, boolean keepDim) The shape withaxisremoved (keepDim=false) or set to 1 (keepDim=true).static Shapescalar()The rank-0 shape: a scalar with one element.int[]strides()Contiguous row-major strides, in elements.toString()
-
Method Details
-
of
The shape with the given sizes (the array is copied). -
scalar
The rank-0 shape: a scalar with one element. -
rank
public int rank()The number of axes. -
dim
public int dim(int axis) Dimensionaxis; negative values count from the end. -
dims
public int[] dims()A copy of the sizes. -
numel
public int numel()The number of elements: the product of the sizes (1 for a scalar). -
axis
public int axis(int axis) Normalises a possibly negative axis to[0, rank). -
strides
public int[] strides()Contiguous row-major strides, in elements. -
reduce
The shape withaxisremoved (keepDim=false) or set to 1 (keepDim=true). -
broadcast
-
broadcastStrides
Strides for reading a tensor of this shape as if it had shapetarget: broadcast dimensions get stride 0. Returned with ranktarget.rank(). -
equals
-
hashCode
-
toString
-