nnvm.symbol

Symbolic graph construction API.

This namespace contains most of the registered operators. For detailed list of operators, checkout Core Tensor Operators

class nnvm.symbol.Symbol(handle)

Symbol is basic operation unit for symbolic graph composition.

attr(key)

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

Parameters:key (str) – The key to get attribute from.
Returns:value – The attribute value of the key, returns None if attribute do not exist.
Return type:str
debug_str()

Get a debug string.

Returns:debug_str – Debug string of the symbol.
Return type:string
get_children()

Gets a new grouped symbol whose output contains inputs to output nodes of the original symbol.

get_internals()

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

Returns:sgroup – The internal of the symbol.
Return type:Symbol
list_attr(recursive=False)

Get all attributes from the symbol.

Parameters:recursive (bool) – Default False. When recursive is True, list recursively all the attributes in the descendents. The attribute names are pre-pended with the symbol names to avoid conflicts. If False, then only attributes that belongs to this symbol is returned, and the attribute names will not be pre-pended with the symbol name.
list_input_names(option='all')

List all the inputs in the symbol.

Parameters:option ({'all', 'read_only', 'aux_state'}, optional) – The listing option - ‘all’ will list all the arguments. - ‘read_only’ lists arguments that are readed by the graph. - ‘aux_state’ lists arguments that are mutated by the graph as state.
Returns:args – List of all the arguments.
Return type:list of string
list_input_variables(option='all')

List all the input variables in the symbol.

Parameters:option ({'all', 'read_only', 'aux_state'}, optional) – The listing option - ‘all’ will list all the arguments. - ‘read_only’ lists arguments that are readed by the graph. - ‘aux_state’ lists arguments that are mutated by the graph as state.
Returns:vars – List of all the variables
Return type:list of symbol
list_output_names()

List all outputs in the symbol.

Returns:returns – List of all the outputs.
Return type:list of string
class nnvm.symbol.Variable

Create a symbolic variable with specified name.

Parameters:
  • name (str) – Name of the variable.
  • init (Symbol or numpy.ndarray) – Symbol or numpy ndarray of initial value for the variable. Note that for symbolic initialization value, it must be able to be defined through InferShape, such as sym.zeros_like(v), in which v is an input or parameter. Otherwise, pass a numpy ndarray instead.
  • kwargs (dict of string -> string) – Additional attributes to set on the variable.
Returns:

variable – The created variable symbol.

Return type:

Symbol

nnvm.symbol.Group(symbols)

Create a symbol that groups symbols together.

Parameters:symbols (list) – List of symbols to be grouped.
Returns:sym – The created group symbol.
Return type:Symbol