Return an NDArray
that lives in the target context.
Return an NDArray
that lives in the target context. If the array
is already in that context, self
is returned. Otherwise, a copy is made.
The target context we want the return value to live in.
A copy or self
as an NDArray
that lives in the target context.
Return a copied numpy array of current array with specified type.
Return a copied numpy array of current array with specified type.
Desired type of result array.
A copy of array content.
Return a sub NDArray that shares memory with current one.
Return a sub NDArray that shares memory with current one. the first axis will be rolled up, which causes its shape different from slice(i, i+1)
index of sub array.
Get context of current NDArray.
Get context of current NDArray.
The context of current NDArray.
Clone the current array
Clone the current array
the copied NDArray in the same context
Copy the content of current array to a new NDArray in the context.
Copy the content of current array to a new NDArray in the context.
Target context we want to copy data to.
The copy target NDArray
Copy the content of current array to other.
Copy the content of current array to other.
Target NDArray or context we want to copy data to.
The copy target NDArray
Release the native memory.
Release the native memory.
The NDArrays it depends on will NOT be disposed.
The object shall never be used after it is disposed.
Dispose all NDArrays who help to construct this array.
Dispose all NDArrays who help to construct this array.
e.g. (a * b + c).disposeDeps() will dispose a, b, c (including their deps) and a * b
this array
Dispose all NDArrays who help to construct this array, excepts those in the arguments.
Dispose all NDArrays who help to construct this array, excepts those in the arguments.
e.g. (a * b + c).disposeDepsExcept(a, b)
will dispose c and a * b.
Note that a, b's dependencies will not be disposed either.
the Array of NDArray not to dispose
this array
Get data type of current NDArray.
Get data type of current NDArray.
class representing type of current ndarray
Return a reshaped NDArray that shares memory with current one.
Return a reshaped NDArray that shares memory with current one.
New shape.
a reshaped NDArray that shares memory with current one.
Set the values of the NDArray
Set the values of the NDArray
Value to set
Current NDArray
Get shape of current NDArray.
Get shape of current NDArray.
an array representing shape of current ndarray
Return a sliced NDArray at the ith position of axis0
Return a sliced NDArray at the ith position of axis0
a sliced NDArray that shares memory with current one.
Return a sliced NDArray that shares memory with current one.
Return a sliced NDArray that shares memory with current one. NDArray only support continuous slicing on axis 0
Starting index of slice.
Finishing index of slice.
a sliced NDArray that shares memory with current one.
Return a copied flat java array of current array (row-major).
Return a copied flat java array of current array (row-major).
A copy of array content.
Return a CPU scalar(float) of current ndarray.
Return a CPU scalar(float) of current ndarray. This ndarray must have shape (1,)
The scalar representation of the ndarray.
Block until all pending writes operations on current NDArray are finished.
Block until all pending writes operations on current NDArray are finished. This function will return when all the pending writes to the current NDArray finishes. There can still be pending read going on when the function returns.
NDArray object in mxnet. NDArray is basic ndarray/Tensor like data structure in mxnet.
NOTE: NDArray is stored in native memory. Use NDArray in a try-with-resources() construct or a [[org.apache.mxnet.ResourceScope]] in a try-with-resource to have them automatically disposed. You can explicitly control the lifetime of NDArray by calling dispose manually. Failure to do this will result in leaking native memory.