Class Index
java.lang.Object
smile.deep.tensor.Index
Indexing a tensor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IndexThe colon (:) is used to slice all elements of a dimension.static final IndexThe ellipsis (...) is used to slice higher-dimensional data structures as in numpy.static final IndexThe None is used to insert a singleton dimension ("unsqueeze" a dimension). -
Method Summary
Modifier and TypeMethodDescriptionstatic Indexof(boolean... indices) Returns the index of multiple elements in a dimension.static Indexof(int i) Returns the index of a single element in a dimension.static Indexof(int... indices) Returns the index of multiple elements in a dimension.static Indexof(long i) Returns the index of a single element in a dimension.static Indexof(long... indices) Returns the index of multiple elements in a dimension.static IndexReturns the tensor index along a dimension.static IndexReturns the slice index for [start, end) with incremental step 1.static IndexReturns the slice index for [start, end) with the given incremental step.static IndexReturns the slice index for [start, end) with incremental step 1.static IndexReturns the slice index for [start, end) with the given incremental step.
-
Field Details
-
Ellipsis
The ellipsis (...) is used to slice higher-dimensional data structures as in numpy. It's designed to mean at this point, insert as many full slices (:) to extend the multidimensional slice to all dimensions. -
Colon
The colon (:) is used to slice all elements of a dimension. -
None
The None is used to insert a singleton dimension ("unsqueeze" a dimension).
-
-
Method Details
-
of
Returns the index of a single element in a dimension.- Parameters:
i- the element index.- Returns:
- the index.
-
of
Returns the index of a single element in a dimension.- Parameters:
i- the element index.- Returns:
- the index.
-
of
Returns the index of multiple elements in a dimension.- Parameters:
indices- the indices of multiple elements.- Returns:
- the index.
-
of
Returns the index of multiple elements in a dimension.- Parameters:
indices- the indices of multiple elements.- Returns:
- the index.
-
of
Returns the index of multiple elements in a dimension.- Parameters:
indices- the boolean flags to select multiple elements. The length of array should match that of the corresponding dimension of tensor.- Returns:
- the index.
-
of
-
slice
-
slice
-
slice
-
slice
-