public class Shape extends Object
Constructor and Description |
---|
Shape() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isColumnVectorShape(int[] shape) |
static boolean |
isMatrix(int[] shape)
Returns whether the passed in shape is a matrix
|
static boolean |
isRowVectorShape(int[] shape) |
static boolean |
isVector(int[] shape)
Returns whether the given shape is a vector
|
static int |
nonZeroDimension(int[] shape) |
static boolean |
scalarEquals(int[] shape1,
int[] shape2)
Returns true if the given shapes are both scalars (0 dimension or shape[0] == 1)
|
static boolean |
shapeEquals(int[] shape1,
int[] shape2)
Returns whether 2 shapes are equals by checking for dimension semantics
as well as array equality
|
static int[] |
sizeForAxes(int[] axes,
int[] shape)
Output an int array for a particular dimension
|
static int[] |
squeeze(int[] shape)
Gets rid of any singleton dimensions of the given array
|
static int[] |
squeeze(int[] shape,
int[] stride)
Gets rid of any singleton dimensions of the given array
|
static boolean |
squeezeEquals(int[] test1,
int[] test2)
Returns true for the case where
singleton dimensions are being compared
|
public static int[] squeeze(int[] shape, int[] stride)
shape
- the shape to squeezepublic static int[] sizeForAxes(int[] axes, int[] shape)
axes
- the axesshape
- the current shapepublic static boolean isVector(int[] shape)
shape
- the shape to testpublic static boolean isMatrix(int[] shape)
shape
- whether the passed in shape is a matrixpublic static int[] squeeze(int[] shape)
shape
- the shape to squeezepublic static int nonZeroDimension(int[] shape)
public static boolean shapeEquals(int[] shape1, int[] shape2)
shape1
- the first shape for comparisonshape2
- the second shape for comparisonpublic static boolean scalarEquals(int[] shape1, int[] shape2)
shape1
- the first shape for comparisonshape2
- the second shape for comparisonpublic static boolean isRowVectorShape(int[] shape)
public static boolean isColumnVectorShape(int[] shape)
public static boolean squeezeEquals(int[] test1, int[] test2)
test1
- the first to testtest2
- the second to testCopyright © 2015. All Rights Reserved.