public class Indices extends Object
| Constructor and Description |
|---|
Indices() |
| Modifier and Type | Method and Description |
|---|---|
static INDArrayIndex[] |
adjustIndices(int[] originalShape,
INDArrayIndex... indexes)
Prunes indices of greater length than the shape
and fills in missing indices if there are any
|
static INDArrayIndex[] |
createFromStartAndEnd(INDArray start,
INDArray end)
Create an n dimensional index
based on the given interval indices.
|
static INDArrayIndex[] |
createFromStartAndEnd(INDArray start,
INDArray end,
boolean inclusive)
Create indices representing intervals
along each dimension
|
static INDArrayIndex[] |
fillIn(int[] shape,
INDArrayIndex... indexes)
Fill in the missing indices to be the
same length as the original shape.
|
static boolean |
isContiguous(int[] indices,
int diff)
Returns whether indices are contiguous
by a certain amount or not
|
static boolean |
isScalar(INDArray indexOver,
INDArrayIndex... indexes)
Check if the given indexes
over the specified array
are searching for a scalar
|
static long |
linearOffset(int index,
INDArray arr)
Compute the linear offset
for an index in an ndarray.
|
static long[] |
offsets(int[] shape,
INDArrayIndex... indices)
The offsets (begin index) for each index
|
static int |
rowNumber(int index,
INDArray arr)
Compute the linear offset
for an index in an ndarray.
|
static int[] |
shape(INDArrayIndex... indices)
Calculate the shape for the given set of indices.
|
static int[] |
shape(int[] shape,
INDArrayIndex... indices)
Calculate the shape for the given set of indices and offsets.
|
static long[] |
shape(long[] shape,
INDArrayIndex... indices) |
static int[] |
stride(INDArray arr,
INDArrayIndex[] indexes,
int... shape)
Return the stride to be used for indexing
|
static int[] |
strides(char ordering,
NDArrayIndex... indexes)
Calculate the strides based on the given indices
|
public static int rowNumber(int index,
INDArray arr)
index - the indexarr - the arraypublic static long linearOffset(int index,
INDArray arr)
index - the indexarr - the arraypublic static long[] offsets(int[] shape,
INDArrayIndex... indices)
indices - the indicespublic static INDArrayIndex[] fillIn(int[] shape, INDArrayIndex... indexes)
shape - the original shapeindexes - the indexes to start frompublic static INDArrayIndex[] adjustIndices(int[] originalShape, INDArrayIndex... indexes)
originalShape - the original shape to adjust toindexes - the indexes to adjustpublic static int[] strides(char ordering,
NDArrayIndex... indexes)
ordering - the ordering to calculate strides forindexes - the indices to calculate stride forpublic static int[] shape(INDArrayIndex... indices)
indices - the indices to calculate the shape forpublic static boolean isContiguous(int[] indices,
int diff)
indices - the indices to testdiff - the difference considered to be contiguouspublic static INDArrayIndex[] createFromStartAndEnd(INDArray start, INDArray end)
start - the start indexesend - the end indexespublic static INDArrayIndex[] createFromStartAndEnd(INDArray start, INDArray end, boolean inclusive)
start - the start indexend - the end indexinclusive - whether the last
index should be includedpublic static int[] shape(int[] shape,
INDArrayIndex... indices)
shape - the original shapeindices - the indices to calculate the shape forpublic static long[] shape(long[] shape,
INDArrayIndex... indices)
public static int[] stride(INDArray arr, INDArrayIndex[] indexes, int... shape)
arr - the array to get the strides forindexes - the indexes to use for computing strideshape - the shape of the outputpublic static boolean isScalar(INDArray indexOver, INDArrayIndex... indexes)
indexOver - the array to index overindexes - the index queryCopyright © 2018. All rights reserved.