org.apache.mxnet

Symbol

Related Docs: object Symbol | package mxnet

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
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

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

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

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

  4. def %(other: Symbol): Symbol

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

  6. def *(other: Symbol): Symbol

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

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

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

  10. def +(other: Symbol): Symbol

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

  12. def -(other: Symbol): Symbol

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

  14. def /(other: Symbol): Symbol

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

  16. def <(other: Symbol): Symbol

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

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

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

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

  21. def >(other: Symbol): Symbol

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

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

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

    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

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

    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]]

    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

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

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

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

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

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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

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

  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

  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

  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

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

  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

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

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

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

    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

    Off-Heap Bytes Allocated for this object

    Off-Heap Bytes Allocated for this object

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

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

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

    Attributes
    protected
    Definition Classes
    WarnIfNotDisposed
  62. def debugStr: String

    Get a debug string.

    Get a debug string.

    returns

    Debug string of the symbol.

  63. def dispose(): Unit

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

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

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

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

  68. def get(index: Int): Symbol

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

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

    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

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

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

    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])

    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 inferType(kwargs: Map[String, DType.DType]): (Seq[DType.DType], Seq[DType.DType], Seq[DType.DType])

    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()

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

    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()

  77. def isDisposed: Boolean

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

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

    List all the arguments in the symbol.

    List all the arguments in the symbol.

    returns

    Array of all the arguments.

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

    Gets all attributes from the symbol.

    Gets all attributes from the symbol.

    returns

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

  81. def listAuxiliaryStates(): IndexedSeq[String]

    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.

  82. def listOutputs(): IndexedSeq[String]

    List all outputs in the symbol.

    List all outputs in the symbol.

    returns

    : List of all the outputs.

  83. def logDisposeWarning(): Unit

    Attributes
    protected
    Definition Classes
    WarnIfNotDisposed
  84. def nativeAddress: CPtrAddress

    native Address associated with this object

    native Address associated with this object

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

    Function Pointer to the NativeDeAllocator of nativeAddress

    Function Pointer to the NativeDeAllocator of nativeAddress

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

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

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

    Definition Classes
    AnyRef
  89. val ref: NativeResourceRef

    Call NativeResource.register to get the reference

    Call NativeResource.register to get the reference

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

    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
  91. def save(fname: String): Unit

    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.

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

    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

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

    Definition Classes
    AnyRef
  94. def toJson: String

    Save symbol into a JSON string.

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

  95. def toString(): String

    Definition Classes
    AnyRef → Any
  96. def tracingEnabled: Boolean

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from NativeResource

Inherited from WarnIfNotDisposed

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped