Class/Object

org.apache.mxnet

Symbol

Related Docs: object Symbol | package mxnet

Permalink

class Symbol extends NativeResource

Symbolic configuration API of mxnet.
WARNING: it is your responsibility to clear this object through dispose().

Linear Supertypes
NativeResource, WarnIfNotDisposed, AutoCloseable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Symbol
  2. NativeResource
  3. WarnIfNotDisposed
  4. AutoCloseable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def %[V](other: V): Symbol

    Permalink
  4. def %(other: Symbol): Symbol

    Permalink
  5. def *[V](other: V): Symbol

    Permalink
  6. def *(other: Symbol): Symbol

    Permalink
  7. def **[V](other: V): Symbol

    Permalink
  8. def **(other: Symbol): Symbol

    Permalink
  9. def +[V](other: V): Symbol

    Permalink
  10. def +(other: Symbol): Symbol

    Permalink
  11. def -[V](other: V): Symbol

    Permalink
  12. def -(other: Symbol): Symbol

    Permalink
  13. def /[V](other: V): Symbol

    Permalink
  14. def /(other: Symbol): Symbol

    Permalink
  15. def <[V](other: V): Symbol

    Permalink
  16. def <(other: Symbol): Symbol

    Permalink
  17. def <=[V](other: V): Symbol

    Permalink
  18. def <=(other: Symbol): Symbol

    Permalink
  19. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  20. def >[V](other: V): Symbol

    Permalink
  21. def >(other: Symbol): Symbol

    Permalink
  22. def >=[V](other: V): Symbol

    Permalink
  23. def >=(other: Symbol): Symbol

    Permalink
  24. def apply(name: String, symbols: Map[String, Symbol]): Symbol

    Permalink

    Invoke symbol as function on inputs.

    Invoke symbol as function on inputs.

    name

    resulting symbol name

    symbols

    provide named symbols

    returns

    the resulting symbol

  25. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  26. def attr(key: String): Option[String]

    Permalink

    Get attribute string from the symbol, this function only works for non-grouped symbol.

    Get attribute string from the symbol, this function only works for non-grouped symbol.

    key

    The key to get attribute from.

    returns

    value The attribute value of the key, returns None if attribute do not exist.

  27. def attrMap(): Map[String, Map[String, String]]

    Permalink

    Recursively gets all attributes from the symbol and its children.

    Recursively gets all attributes from the symbol and its children.

    returns

    Map[Map[String, String]], There is a key in the returned dict for every child with non-empty attribute set. For each symbol, the name of the symbol is its key in the dict and the correspond value is that symbol's attribute list (itself a dictionary).

  28. def bind(ctx: Context, args: Map[String, NDArray]): Executor

    Permalink
  29. def bind(ctx: Context, args: Seq[NDArray]): Executor

    Permalink
  30. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Map[String, NDArray]): Executor

    Permalink
  31. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Seq[NDArray]): Executor

    Permalink
  32. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Map[String, NDArray]): Executor

    Permalink
  33. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Seq[NDArray]): Executor

    Permalink
  34. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Map[String, NDArray], gradsReq: Map[String, String], auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  35. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Map[String, NDArray], gradsReq: Map[String, String], auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  36. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Seq[NDArray], gradsReq: Map[String, String], auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  37. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Seq[NDArray], gradsReq: Map[String, String], auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  38. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Map[String, NDArray], gradsReq: Map[String, String], auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  39. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Map[String, NDArray], gradsReq: Map[String, String], auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  40. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Seq[NDArray], gradsReq: Map[String, String], auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  41. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Seq[NDArray], gradsReq: Map[String, String], auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  42. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Map[String, NDArray], gradsReq: Seq[String], auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  43. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Map[String, NDArray], gradsReq: Seq[String], auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  44. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Seq[NDArray], gradsReq: Seq[String], auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  45. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Seq[NDArray], gradsReq: Seq[String], auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  46. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Map[String, NDArray], gradsReq: Seq[String], auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  47. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Map[String, NDArray], gradsReq: Seq[String], auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  48. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Seq[NDArray], gradsReq: Seq[String], auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  49. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Seq[NDArray], gradsReq: Seq[String], auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  50. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Map[String, NDArray], gradReq: String, auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  51. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Map[String, NDArray], gradReq: String, auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  52. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Seq[NDArray], gradReq: String, auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  53. def bind(ctx: Context, args: Map[String, NDArray], argsGrad: Seq[NDArray], gradReq: String, auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  54. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Map[String, NDArray], gradReq: String, auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  55. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Map[String, NDArray], gradReq: String, auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  56. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Seq[NDArray], gradReq: String, auxStates: Map[String, NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink
  57. def bind(ctx: Context, args: Seq[NDArray], argsGrad: Seq[NDArray], gradReq: String, auxStates: Seq[NDArray], group2ctx: Map[String, Context], sharedExec: Executor): Executor

    Permalink

    Bind current symbol to get an executor.

    Bind current symbol to get an executor.

    ctx

    Context The device context the generated executor to run on.

    args

    Input arguments to the symbol.

    • If type is list of NDArray, the position is in the same order of list_arguments.
    • If type is dict of str to NDArray, then it maps the name of arguments to the corresponding NDArray.
    • In either case, all the arguments must be provided.
    argsGrad

    When specified, args_grad provide NDArrays to hold the result of gradient value in backward.

    • If type is list of NDArray, the position is in the same order of list_arguments.
    • If type is dict of str to NDArray, then it maps the name of arguments to the corresponding NDArray.
    • When the type is dict of str to NDArray, users only need to provide the dict for needed argument gradient. Only the specified argument gradient will be calculated.
    gradReq

    {'write', 'add', 'null'}, or list of str or dict of str to str, optional Specifies how we should update the gradient to the args_grad.

    • 'write' means everytime gradient is write to specified args_grad NDArray.
    • 'add' means everytime gradient is add to the specified NDArray.
    • 'null' means no action is taken, the gradient may not be calculated.
    auxStates

    Input auxiliary states to the symbol, only need to specify when list_auxiliary_states is not empty.

    • If type is list of NDArray, the position is in the same order of listAuxiliaryStates
    • If type is dict of str to NDArray, then it maps the name of auxiliary_states to the corresponding NDArray,
    • In either case, all the auxiliary_states need to be provided.
    group2ctx

    The dict mapping the ctx_group attribute to the context assignment.

    sharedExec

    Executor to share memory with.

    • This is intended for runtime reshaping, variable length sequences, etc.
    • The returned executor shares state with shared_exec, and should not be used in parallel with it.
    returns

    The generated Executor

    Note

    Auxiliary states are special states of symbols that do not corresponds to an argument, and do not have gradient. But still be useful for the specific operations. A common example of auxiliary state is the moving_mean and moving_variance in BatchNorm. Most operators do not have auxiliary states and this parameter can be safely ignored. User can give up gradient by using a dict in args_grad and only specify gradient they interested in.

  58. val bytesAllocated: Long

    Permalink

    Off-Heap Bytes Allocated for this object

    Off-Heap Bytes Allocated for this object

    Definition Classes
    Symbol → NativeResource
  59. def clone(): Symbol

    Permalink
    Definition Classes
    Symbol → AnyRef
  60. def close(): Unit

    Permalink
    Definition Classes
    NativeResource → AutoCloseable
  61. val creationTrace: Option[Array[StackTraceElement]]

    Permalink
    Attributes
    protected
    Definition Classes
    WarnIfNotDisposed
  62. def debugStr: String

    Permalink

    Get a debug string.

    Get a debug string.

    returns

    Debug string of the symbol.

  63. def dispose(): Unit

    Permalink
    Definition Classes
    NativeResource
  64. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  65. def equals(arg0: Any): Boolean

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

    Permalink
    Attributes
    protected
    Definition Classes
    WarnIfNotDisposed → AnyRef
  67. def get(name: String): Symbol

    Permalink
  68. def get(index: Int): Symbol

    Permalink
  69. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  70. def getInternals(): Symbol

    Permalink

    Get a new grouped symbol whose output contains all the internal outputs of this symbol.

    Get a new grouped symbol whose output contains all the internal outputs of this symbol.

    returns

    The internal of the symbol.

  71. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  72. def inferShape(keys: Array[String], indPtr: Array[Int], values: Array[Int]): (IndexedSeq[Shape], IndexedSeq[Shape], IndexedSeq[Shape])

    Permalink
  73. def inferShape(kwargs: Map[String, Shape]): (IndexedSeq[Shape], IndexedSeq[Shape], IndexedSeq[Shape])

    Permalink

    Infer the shape of outputs and arguments of given known shapes of arguments.

    Infer the shape of outputs and arguments of given known shapes of arguments. User can either pass in the known shapes in positional way or keyword argument way. Tuple of Nones is returned if there is not enough information passed in. An error will be raised if there is inconsistency found in the known shapes passed in.

    kwargs

    Provide keyword arguments of known shapes.

    returns

    argShapes List of shapes of arguments. The order is in the same order as list_arguments() outShapes List of shapes of outputs. The order is in the same order as list_outputs() auxShapes List of shapes of outputs. The order is in the same order as list_auxiliary()

  74. def inferShape(args: Shape*): (IndexedSeq[Shape], IndexedSeq[Shape], IndexedSeq[Shape])

    Permalink

    Infer the shape of outputs and arguments of given known shapes of arguments.

    Infer the shape of outputs and arguments of given known shapes of arguments. User can either pass in the known shapes in positional way or keyword argument way. Tuple of Nones is returned if there is not enough information passed in. An error will be raised if there is inconsistency found in the known shapes passed in.

    args

    Provide shape of arguments in a positional way. Unknown shape can be marked as None

    returns

    argShapes List of shapes of arguments. The order is in the same order as list_arguments() outShapes List of shapes of outputs. The order is in the same order as list_outputs() auxShapes List of shapes of outputs. The order is in the same order as list_auxiliary()

  75. def inferShape(args: IndexedSeq[DataDesc]): (IndexedSeq[Shape], IndexedSeq[Shape], IndexedSeq[Shape])

    Permalink

    Infer the shape of outputs and arguments of given known shapes of arguments.

    Infer the shape of outputs and arguments of given known shapes of arguments. User can either pass in the known shapes in positional way or keyword argument way. Tuple of Nones is returned if there is not enough information passed in. An error will be raised if there is inconsistency found in the known shapes passed in.

    args

    Provide a list of DataDesc containing the shapes to resolve

    returns

    argShapes List of shapes of arguments. The order is in the same order as list_arguments() outShapes List of shapes of outputs. The order is in the same order as list_outputs() auxShapes List of shapes of outputs. The order is in the same order as list_auxiliary()

  76. def inferType(kwargs: Map[String, DType.DType]): (Seq[DType.DType], Seq[DType.DType], Seq[DType.DType])

    Permalink

    Infer the type of outputs and arguments of given known types of arguments.

    Infer the type of outputs and arguments of given known types of arguments. Tuple of Nones is returned if there is not enough information passed in. An error will be raised if there is inconsistency found in the known types passed in.

    kwargs

    Provide keyword arguments of known types.

    returns

    argTypes : list of numpy.dtype or None List of types of arguments. The order is in the same order as list_arguments() outTypes : list of numpy.dtype or None List of types of outputs. The order is in the same order as list_outputs() auxTypes : list of numpy.dtype or None List of types of outputs. The order is in the same order as list_auxiliary()

  77. def inferType(args: DType.DType*): (Seq[DType.DType], Seq[DType.DType], Seq[DType.DType])

    Permalink

    Infer the type of outputs and arguments of given known types of arguments.

    Infer the type of outputs and arguments of given known types of arguments. Tuple of Nones is returned if there is not enough information passed in. An error will be raised if there is inconsistency found in the known types passed in.

    args

    Provide type of arguments in a positional way. Unknown type can be marked as null

    returns

    argTypes : list of numpy.dtype or None List of types of arguments. The order is in the same order as list_arguments() outTypes : list of numpy.dtype or None List of types of outputs. The order is in the same order as list_outputs() auxTypes : list of numpy.dtype or None List of types of outputs. The order is in the same order as list_auxiliary()

  78. def isDisposed: Boolean

    Permalink
    Definition Classes
    NativeResource → WarnIfNotDisposed
  79. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  80. def listArguments(): IndexedSeq[String]

    Permalink

    List all the arguments in the symbol.

    List all the arguments in the symbol.

    returns

    Array of all the arguments.

  81. def listAttr(): Map[String, String]

    Permalink

    Gets all attributes from the symbol.

    Gets all attributes from the symbol.

    returns

    Map[String, String], mapping attribute keys to values.

  82. def listAuxiliaryStates(): IndexedSeq[String]

    Permalink

    List all auxiliary states in the symbol.

    List all auxiliary states in the symbol.

    returns

    The names of the auxiliary states.

    Note

    Auxiliary states are special states of symbols that do not corresponds to an argument, and do not have gradient. But still be useful for the specific operations. A common example of auxiliary state is the moving_mean and moving_variance in BatchNorm. Most operators do not have Auxiliary states.

  83. def listOutputs(): IndexedSeq[String]

    Permalink

    List all outputs in the symbol.

    List all outputs in the symbol.

    returns

    : List of all the outputs.

  84. def logDisposeWarning(): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    WarnIfNotDisposed
  85. def nativeAddress: CPtrAddress

    Permalink

    native Address associated with this object

    native Address associated with this object

    Definition Classes
    Symbol → NativeResource
  86. def nativeDeAllocator: (CPtrAddress) ⇒ Int

    Permalink

    Function Pointer to the NativeDeAllocator of nativeAddress

    Function Pointer to the NativeDeAllocator of nativeAddress

    Definition Classes
    Symbol → NativeResource
  87. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  90. val ref: NativeResourceRef

    Permalink

    Call NativeResource.register to get the reference

    Call NativeResource.register to get the reference

    Definition Classes
    Symbol → NativeResource
  91. def register(): NativeResourceRef

    Permalink

    Register this object for PhantomReference tracking and in ResourceScope if used inside ResourceScope.

    Register this object for PhantomReference tracking and in ResourceScope if used inside ResourceScope.

    returns

    NativeResourceRef that tracks reachability of this object using PhantomReference

    Definition Classes
    NativeResource
  92. def save(fname: String): Unit

    Permalink

    Save symbol into file.

    Save symbol into file. You can also use pickle to do the job if you only work on python. The advantage of load/save is the file is language agnostic. This means the file saved using save can be loaded by other language binding of mxnet. You also get the benefit being able to directly load/save from cloud storage(S3, HDFS)

    fname

    The name of the file

    • s3://my-bucket/path/my-s3-symbol
    • hdfs://my-bucket/path/my-hdfs-symbol
    • /path-to/my-local-symbol
    See also

    Symbol.load : Used to load symbol from file.

  93. def simpleBind(ctx: Context, gradReq: String = "write", shapeDict: Map[String, Shape], typeDict: Map[String, DType.DType] = null): Executor

    Permalink

    Bind current symbol to get an executor, allocate all the ndarrays needed.

    Bind current symbol to get an executor, allocate all the ndarrays needed. Allows specifying data types. This function will ask user to pass in ndarray of position they like to bind to, and it will automatically allocate the ndarray for arguments and auxiliary states that user did not specify explicitly.

    ctx

    The device context the generated executor to run on.

    gradReq

    {'write', 'add', 'null'}, or list of str or dict of str to str, optional Specifies how we should update the gradient to the args_grad.

    • 'write' means everytime gradient is write to specified args_grad NDArray.
    • 'add' means everytime gradient is add to the specified NDArray.
    • 'null' means no action is taken, the gradient may not be calculated.
    shapeDict

    Input shape dictionary, name->shape

    typeDict

    Input type dictionary, name->dtype

    returns

    The generated Executor

  94. def simpleBind(ctx: Context, gradReq: String, descs: IndexedSeq[DataDesc]): Executor

    Permalink

    Bind current symbol to get an executor, allocate all the ndarrays needed.

    Bind current symbol to get an executor, allocate all the ndarrays needed. Allows specifying data types. This function will ask user to pass in ndarray of position they like to bind to, and it will automatically allocate the ndarray for arguments and auxiliary states that user did not specify explicitly.

    ctx

    The device context the generated executor to run on.

    gradReq

    {'write', 'add', 'null'}, or list of str or dict of str to str, optional Specifies how we should update the gradient to the args_grad.

    • 'write' means everytime gradient is write to specified args_grad NDArray.
    • 'add' means everytime gradient is add to the specified NDArray.
    • 'null' means no action is taken, the gradient may not be calculated.
    returns

    The generated Executor

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

    Permalink
    Definition Classes
    AnyRef
  96. def toJson: String

    Permalink

    Save symbol into a JSON string.

    Save symbol into a JSON string. See Also symbol.loadJson : Used to load symbol from JSON string.

  97. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  98. def tracingEnabled: Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    WarnIfNotDisposed
  99. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from NativeResource

Inherited from WarnIfNotDisposed

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped