An index used for slicing a view out of an N-dimensional array.
A slice, i.e. a reduced view, of an N-dimensional array is obtain by calling
slice(Index)
, given a list of indices that select which elements on a given dimension should be
included/excluded from that view.
Public Methods
abstract Dimension | |
abstract long |
begin
()
Get the start of the index, for strided slice style indexing.
|
abstract boolean |
beginMask
()
Get whether the Index should start at the beginning of the dimension, for strided slice style indexing.
|
abstract long |
end
()
Get the end of the index, strided slice style indexing.
|
abstract boolean |
endMask
()
Get whether the Index should end at the beginning of the dimension, for strided slice style indexing.
|
abstract boolean |
isEllipsis
()
Returns true if this index is an ellipsis, expanding to take as many dimensions as possible (and applying all() to
them)
|
abstract boolean |
isNewAxis
()
Returns true if this index is a new axis, adding a dimension of size 1
|
abstract boolean |
isPoint
()
Returns true if this index is a single point, reducing the number of dimensions by one
|
abstract boolean |
isStridedSlicingCompliant
()
Get whether the Index supports strided slice style indexing (using start, end, stride, and flags, i.e.
|
abstract long |
mapCoordinate
(long coordinate,
Dimension
dim)
Transforms an element coordinate to a new coordinate by applying this index to the given dimension.
|
abstract long |
numElements
(
Dimension
dim)
Returns the number of elements that can be retrieved using this index on the given dimension.
|
abstract long |
stride
()
Get the stride of the index, for strided slice style indexing.
|
Public Methods
public abstract Dimension apply ( Dimension dim)
Applies this index to the given dimension.
When accessing the elements from the returned dimension, this index will automatically apply and may transform the original position.
Parameters
dim | dimension to apply this index to |
---|
Returns
- an indexed dimension
public abstract long begin ()
Get the start of the index, for strided slice style indexing.
public abstract boolean beginMask ()
Get whether the Index should start at the beginning of the dimension, for strided slice style indexing.
public abstract long end ()
Get the end of the index, strided slice style indexing.
public abstract boolean endMask ()
Get whether the Index should end at the beginning of the dimension, for strided slice style indexing.
public abstract boolean isEllipsis ()
Returns true if this index is an ellipsis, expanding to take as many dimensions as possible (and applying all() to them)
public abstract boolean isNewAxis ()
Returns true if this index is a new axis, adding a dimension of size 1
public abstract boolean isPoint ()
Returns true if this index is a single point, reducing the number of dimensions by one
public abstract boolean isStridedSlicingCompliant ()
Get whether the Index supports strided slice style indexing (using start, end, stride, and flags, i.e. TensorFlow's ).
public abstract long mapCoordinate (long coordinate, Dimension dim)
Transforms an element coordinate to a new coordinate by applying this index to the given dimension.
For example, if the coordinate is 0 and this index flips the
n
elements on this
dimension, then the returned value will be
n-1
.
Parameters
coordinate | coordinate to transform |
---|---|
dim | dimension the indexed dimension |
Returns
- transformed coordinate
public abstract long numElements ( Dimension dim)
Returns the number of elements that can be retrieved using this index on the given dimension.
An index that maps one-by-one all elements of the dimensions will return a value
equal to
dim.numElements()
, while an index that only maps a subset of these will return a smaller value.
Parameters
dim | the indexed dimension |
---|
Returns
- number of elements accessible
public abstract long stride ()
Get the stride of the index, for strided slice style indexing.