Package ai.djl.ndarray.index
Class NDArrayIndexer
java.lang.Object
ai.djl.ndarray.index.NDArrayIndexer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract NDArray
get
(NDArray array, NDIndexFullPick fullPick) Returns a subarray by picking the elements.abstract NDArray
get
(NDArray array, NDIndexFullSlice fullSlice) Returns a subarray at the slice.abstract NDArray
get
(NDArray array, NDIndexFullTake fullTake) Returns a subarray by taken the elements from one axis.Returns a subarray at the given index.void
set
(NDArray array, NDIndexBooleans indices, NDArray value) Sets the values of the array at the boolean locations with an array.abstract void
set
(NDArray array, NDIndexFullSlice fullSlice, NDArray value) Sets the values of the array at the fullSlice with an array.abstract void
set
(NDArray array, NDIndexFullSlice fullSlice, Number value) Sets the values of the array at the fullSlice with a number.void
Sets the entries of array at the indexed locations with the parameter value.void
Sets a scalar value in the array at the indexed location.
-
Constructor Details
-
NDArrayIndexer
public NDArrayIndexer()
-
-
Method Details
-
get
Returns a subarray by picking the elements.- Parameters:
array
- the array to get fromfullPick
- the elements to pick- Returns:
- the subArray
-
get
Returns a subarray by taken the elements from one axis.- Parameters:
array
- the array to get fromfullTake
- the elements to pick- Returns:
- the subArray
-
get
Returns a subarray at the slice.- Parameters:
array
- the array to get fromfullSlice
- the fullSlice index of the array- Returns:
- the subArray
-
get
Returns a subarray at the given index.- Parameters:
array
- the array to get fromindex
- the index to get- Returns:
- the subarray
-
set
Sets the entries of array at the indexed locations with the parameter value. The value can be only Number or NDArray.- Parameters:
array
- the array to setindex
- the index to set at in the arrayvalue
- the value to set with
-
set
Sets the values of the array at the fullSlice with an array.- Parameters:
array
- the array to setfullSlice
- the fullSlice of the index to set in the arrayvalue
- the value to set with
-
set
Sets the values of the array at the boolean locations with an array.- Parameters:
array
- the array to setindices
- a boolean array where true indicates values to updatevalue
- the value to set with when condition is true
-
set
Sets the values of the array at the fullSlice with a number.- Parameters:
array
- the array to setfullSlice
- the fullSlice of the index to set in the arrayvalue
- the value to set with
-
setScalar
Sets a scalar value in the array at the indexed location.- Parameters:
array
- the array to setindex
- the index to set at in the arrayvalue
- the value to set with- Throws:
IllegalArgumentException
- if the index does not point to a scalar value in the array
-