Table Of Contents
Table Of Contents


class mxnet.gluon.Constant(name, value)[source]

A constant parameter for holding immutable tensors. Constant`s are ignored by `autograd and Trainer, thus their values will not change during training. But you can still update their values manually with the set_data method.

Constant s can be created with either:

const = mx.gluon.Constant('const', [[1,2],[3,4]])


class Block(gluon.Block):
    def __init__(self, **kwargs):
        super(Block, self).__init__(**kwargs)
        self.const = self.params.get_constant('const', [[1,2],[3,4]])
  • name (str) – Name of the parameter.

  • value (array-like) – Initial value for the constant.