Package smile.deep.tensor
Class Index
java.lang.Object
smile.deep.tensor.Index
Indexing a tensor.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Index
The colon (:) is used to slice all elements of a dimension.static final Index
The ellipsis (...) is used to slice higher-dimensional data structures as in numpy.static final Index
The None is used to insert a singleton dimension ("unsqueeze" a dimension). -
Method Summary
Modifier and TypeMethodDescriptionstatic Index
of
(boolean... indices) Returns the index of multiple elements in a dimension.static Index
of
(int i) Returns the index of a single element in a dimension.static Index
of
(int... indices) Returns the index of multiple elements in a dimension.static Index
of
(long i) Returns the index of a single element in a dimension.static Index
of
(long... indices) Returns the index of multiple elements in a dimension.static Index
Returns the tensor index along a dimension.static Index
Returns the slice index for [start, end) with step 1.static Index
Returns the slice index for [start, end) with step 1.static Index
Returns the slice index for [start, end) with step 1.static Index
Returns the slice index for [start, end) with the given 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
Returns the tensor index along a dimension.- Parameters:
index
- the tensor index.- Returns:
- the index.
-
slice
Returns the slice index for [start, end) with step 1.- Parameters:
start
- the start index.end
- the end index.- Returns:
- the slice.
-
slice
Returns the slice index for [start, end) with step 1.- Parameters:
start
- the start index.end
- the end index.step
- the incremental step.- Returns:
- the slice.
-
slice
Returns the slice index for [start, end) with step 1.- Parameters:
start
- the start index.end
- the end index.- Returns:
- the slice.
-
slice
Returns the slice index for [start, end) with the given step.- Parameters:
start
- the start index.end
- the end index.step
- the incremental step.- Returns:
- the slice.
-