mindspore.ops.Assign

class mindspore.ops.Assign[source]

Assigns Parameter with a value.

Refer to mindspore.ops.assign() for more details.

Supported Platforms:

Ascend GPU CPU

Examples

>>> value = Tensor([2.0], mindspore.float32)
>>> variable = mindspore.Parameter(Tensor([1.0], mindspore.float32), name="variable")
>>> assign = ops.Assign()
>>> x = assign(variable, value)
>>> print(variable.asnumpy())
[2.]