org.apache.mxnet.javaapi

NDArray

Related Docs: object NDArray | package javaapi

class NDArray extends AnyRef

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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. NDArray
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new NDArray(arr: List[Float], shape: Shape, ctx: Context)

  2. new NDArray(arr: Array[Float], shape: Shape, ctx: Context)

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. def T: NDArray

  5. def add(other: Float): NDArray

  6. def add(other: NDArray): NDArray

  7. def addInplace(other: Float): NDArray

  8. def addInplace(other: NDArray): NDArray

  9. def asInContext(context: Context): NDArray

    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.

    context

    The target context we want the return value to live in.

    returns

    A copy or self as an NDArray that lives in the target context.

  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def asType(dtype: DType.DType): NDArray

    Return a copied numpy array of current array with specified type.

    Return a copied numpy array of current array with specified type.

    dtype

    Desired type of result array.

    returns

    A copy of array content.

  12. def at(idx: Int): NDArray

    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)

    idx

    index of sub array.

  13. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def context: Context

    Get context of current NDArray.

    Get context of current NDArray.

    returns

    The context of current NDArray.

  15. def copy(): NDArray

    Clone the current array

    Clone the current array

    returns

    the copied NDArray in the same context

  16. def copyTo(ctx: Context): NDArray

    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.

    ctx

    Target context we want to copy data to.

    returns

    The copy target NDArray

  17. def copyTo(other: NDArray): NDArray

    Copy the content of current array to other.

    Copy the content of current array to other.

    other

    Target NDArray or context we want to copy data to.

    returns

    The copy target NDArray

  18. def dispose(): Unit

    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.

  19. def disposeDeps(): NDArray

    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

    returns

    this array

  20. def disposeDepsExcept(arr: Array[NDArray]): NDArray

    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.

    arr

    the Array of NDArray not to dispose

    returns

    this array

  21. def div(other: Float): NDArray

  22. def div(other: NDArray): NDArray

  23. def divInplace(other: Float): NDArray

  24. def divInplace(other: NDArray): NDArray

  25. def dtype: DType.DType

    Get data type of current NDArray.

    Get data type of current NDArray.

    returns

    class representing type of current ndarray

  26. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  27. def equals(obj: Any): Boolean

    Definition Classes
    NDArray → AnyRef → Any
  28. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  29. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  30. def greater(other: Float): NDArray

  31. def greater(other: NDArray): NDArray

  32. def greaterEqual(other: Float): NDArray

  33. def greaterEqual(other: NDArray): NDArray

  34. def hashCode(): Int

    Definition Classes
    NDArray → AnyRef → Any
  35. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  36. def lesser(other: Float): NDArray

  37. def lesser(other: NDArray): NDArray

  38. def lesserEqual(other: Float): NDArray

  39. def lesserEqual(other: NDArray): NDArray

  40. def mod(other: Float): NDArray

  41. def mod(other: NDArray): NDArray

  42. def modInplace(other: Float): NDArray

  43. def modInplace(other: NDArray): NDArray

  44. def multiply(other: Float): NDArray

  45. def multiply(other: NDArray): NDArray

  46. def multiplyInplace(other: Float): NDArray

  47. def multiplyInplace(other: NDArray): NDArray

  48. val nd: mxnet.NDArray

  49. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  50. final def notify(): Unit

    Definition Classes
    AnyRef
  51. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  52. def pow(other: Float): NDArray

  53. def pow(other: NDArray): NDArray

  54. def powInplace(other: Float): NDArray

  55. def powInplace(other: NDArray): NDArray

  56. def reshape(dims: Array[Int]): NDArray

    Return a reshaped NDArray that shares memory with current one.

    Return a reshaped NDArray that shares memory with current one.

    dims

    New shape.

    returns

    a reshaped NDArray that shares memory with current one.

  57. def serialize(): Array[Byte]

  58. def set(other: Array[Float]): NDArray

  59. def set(other: NDArray): NDArray

  60. def set(value: Float): NDArray

    Set the values of the NDArray

    Set the values of the NDArray

    value

    Value to set

    returns

    Current NDArray

  61. def shape: Shape

    Get shape of current NDArray.

    Get shape of current NDArray.

    returns

    an array representing shape of current ndarray

  62. def size: Int

  63. def slice(i: Int): NDArray

    Return a sliced NDArray at the ith position of axis0

    Return a sliced NDArray at the ith position of axis0

    i
    returns

    a sliced NDArray that shares memory with current one.

  64. def slice(start: Int, stop: Int): NDArray

    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

    start

    Starting index of slice.

    stop

    Finishing index of slice.

    returns

    a sliced NDArray that shares memory with current one.

  65. def subtract(other: Float): NDArray

  66. def subtract(other: NDArray): NDArray

  67. def subtractInplace(other: Float): NDArray

  68. def subtractInplace(other: NDArray): NDArray

  69. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  70. def toArray: Array[Float]

    Return a copied flat java array of current array (row-major).

    Return a copied flat java array of current array (row-major).

    returns

    A copy of array content.

  71. def toScalar: Float

    Return a CPU scalar(float) of current ndarray.

    Return a CPU scalar(float) of current ndarray. This ndarray must have shape (1,)

    returns

    The scalar representation of the ndarray.

  72. def toString(): String

    Definition Classes
    AnyRef → Any
  73. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  74. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  75. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  76. def waitToRead(): Unit

    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.

Inherited from AnyRef

Inherited from Any

Ungrouped