mindspore.nn.ParameterUpdate

class mindspore.nn.ParameterUpdate(param)[source]

Cell that updates parameters.

With this Cell, one can manually update param with the input Tensor.

Parameters

param (Parameter) – The parameter to be updated manually.

Raises

KeyError – If parameter with the specified name does not exist.

Supported Platforms:

Ascend

Examples

>>> network = nn.Dense(3, 4)
>>> param = network.parameters_dict()['weight']
>>> update = nn.ParameterUpdate(param)
>>> update.phase = "update_param"
>>> weight = Tensor(np.arange(12).reshape((4, 3)), mindspore.float32)
>>> output = update(weight)