mxnet.name

Automatic naming support for symbolic API.

Classes

NameManager()

NameManager to do automatic naming.

Prefix(prefix)

A name manager that attaches a prefix to all names.

class mxnet.name.NameManager[source]

Bases: object

NameManager to do automatic naming.

Developers can also inherit from this class to change naming behavior.

Methods

get(name, hint)

Get the canonical name for a symbol.

get(name, hint)[source]

Get the canonical name for a symbol.

This is the default implementation. If the user specifies a name, the user-specified name will be used.

When user does not specify a name, we automatically generate a name based on the hint string.

Parameters
  • name (str or None) – The name specified by the user.

  • hint (str) – A hint string, which can be used to generate name.

Returns

full_name – A canonical name for the symbol.

Return type

str

class mxnet.name.Prefix(prefix)[source]

Bases: mxnet.name.NameManager

A name manager that attaches a prefix to all names.

Examples

Methods

get(name, hint)

Get the canonical name for a symbol.

>>> import mxnet as mx
>>> data = mx.symbol.Variable('data')
>>> with mx.name.Prefix('mynet_'):
        net = mx.symbol.FullyConnected(data, num_hidden=10, name='fc1')
>>> net.list_arguments()
['data', 'mynet_fc1_weight', 'mynet_fc1_bias']
get(name, hint)[source]

Get the canonical name for a symbol.

This is the default implementation. If the user specifies a name, the user-specified name will be used.

When user does not specify a name, we automatically generate a name based on the hint string.

Parameters
  • name (str or None) – The name specified by the user.

  • hint (str) – A hint string, which can be used to generate name.

Returns

full_name – A canonical name for the symbol.

Return type

str