Class/Object

org.apache.mxnet.javaapi

NDArray

Related Docs: object NDArray | package javaapi

Permalink

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
Visibility
  1. Public
  2. All

Instance Constructors

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

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

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

    Permalink

Value Members

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. def T: NDArray

    Permalink
  5. def add(other: Double): NDArray

    Permalink
  6. def add(other: Float): NDArray

    Permalink
  7. def add(other: NDArray): NDArray

    Permalink
  8. def addInplace(other: Double): NDArray

    Permalink
  9. def addInplace(other: Float): NDArray

    Permalink
  10. def addInplace(other: NDArray): NDArray

    Permalink
  11. def asInContext(context: Context): NDArray

    Permalink

    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.

  12. final def asInstanceOf[T0]: T0

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

    Permalink

    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.

  14. def at(idx: Int): NDArray

    Permalink

    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.

  15. def clone(): AnyRef

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

    Permalink

    Get context of current NDArray.

    Get context of current NDArray.

    returns

    The context of current NDArray.

  17. def copy(): NDArray

    Permalink

    Clone the current array

    Clone the current array

    returns

    the copied NDArray in the same context

  18. def copyTo(ctx: Context): NDArray

    Permalink

    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

  19. def copyTo(other: NDArray): NDArray

    Permalink

    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

  20. def dispose(): Unit

    Permalink

    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.

  21. def disposeDeps(): NDArray

    Permalink

    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

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

    Permalink

    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

  23. def div(other: Double): NDArray

    Permalink
  24. def div(other: Float): NDArray

    Permalink
  25. def div(other: NDArray): NDArray

    Permalink
  26. def divInplace(other: Double): NDArray

    Permalink
  27. def divInplace(other: Float): NDArray

    Permalink
  28. def divInplace(other: NDArray): NDArray

    Permalink
  29. def dtype: DType.DType

    Permalink

    Get data type of current NDArray.

    Get data type of current NDArray.

    returns

    class representing type of current ndarray

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  34. def greater(other: Double): NDArray

    Permalink
  35. def greater(other: Float): NDArray

    Permalink
  36. def greater(other: NDArray): NDArray

    Permalink
  37. def greaterEqual(other: Double): NDArray

    Permalink
  38. def greaterEqual(other: Float): NDArray

    Permalink
  39. def greaterEqual(other: NDArray): NDArray

    Permalink
  40. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  42. def lesser(other: Double): NDArray

    Permalink
  43. def lesser(other: Float): NDArray

    Permalink
  44. def lesser(other: NDArray): NDArray

    Permalink
  45. def lesserEqual(other: Double): NDArray

    Permalink
  46. def lesserEqual(other: Float): NDArray

    Permalink
  47. def lesserEqual(other: NDArray): NDArray

    Permalink
  48. def mod(other: Double): NDArray

    Permalink
  49. def mod(other: Float): NDArray

    Permalink
  50. def mod(other: NDArray): NDArray

    Permalink
  51. def modInplace(other: Double): NDArray

    Permalink
  52. def modInplace(other: Float): NDArray

    Permalink
  53. def modInplace(other: NDArray): NDArray

    Permalink
  54. def multiply(other: Double): NDArray

    Permalink
  55. def multiply(other: Float): NDArray

    Permalink
  56. def multiply(other: NDArray): NDArray

    Permalink
  57. def multiplyInplace(other: Double): NDArray

    Permalink
  58. def multiplyInplace(other: Float): NDArray

    Permalink
  59. def multiplyInplace(other: NDArray): NDArray

    Permalink
  60. val nd: mxnet.NDArray

    Permalink
  61. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  62. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  63. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  64. def pow(other: Double): NDArray

    Permalink
  65. def pow(other: Float): NDArray

    Permalink
  66. def pow(other: NDArray): NDArray

    Permalink
  67. def powInplace(other: Double): NDArray

    Permalink
  68. def powInplace(other: Float): NDArray

    Permalink
  69. def powInplace(other: NDArray): NDArray

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

    Permalink

    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.

  71. def serialize(): Array[Byte]

    Permalink
  72. def set(other: Array[Double]): NDArray

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

    Permalink
  74. def set(other: NDArray): NDArray

    Permalink
  75. def set(value: Double): NDArray

    Permalink
  76. def set(value: Float): NDArray

    Permalink

    Set the values of the NDArray

    Set the values of the NDArray

    value

    Value to set

    returns

    Current NDArray

  77. def shape: Shape

    Permalink

    Get shape of current NDArray.

    Get shape of current NDArray.

    returns

    an array representing shape of current ndarray

  78. def size: Int

    Permalink
  79. def slice(i: Int): NDArray

    Permalink

    Return a sliced NDArray at the ith position of axis0

    Return a sliced NDArray at the ith position of axis0

    returns

    a sliced NDArray that shares memory with current one.

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

    Permalink

    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.

  81. def subtract(other: Double): NDArray

    Permalink
  82. def subtract(other: Float): NDArray

    Permalink
  83. def subtract(other: NDArray): NDArray

    Permalink
  84. def subtractInplace(other: Double): NDArray

    Permalink
  85. def subtractInplace(other: Float): NDArray

    Permalink
  86. def subtractInplace(other: NDArray): NDArray

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

    Permalink
    Definition Classes
    AnyRef
  88. def toArray: Array[Float]

    Permalink

    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.

  89. def toFloat64Array: Array[Double]

    Permalink

    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.

  90. def toFloat64Scalar: Double

    Permalink

    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.

  91. def toScalar: Float

    Permalink

    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.

  92. def toString(): String

    Permalink
    Definition Classes
    NDArray → AnyRef → Any
  93. final def wait(): Unit

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

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

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

    Permalink

    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