mindspore.ops.assign
- mindspore.ops.assign(variable, value)[source]
Assigns a parameter or tensor with a value.
Support implicit type conversion and type promotion.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> value = mindspore.tensor([2.0], mindspore.float32) >>> variable = mindspore.Parameter(mindspore.tensor([1.0], mindspore.float32), name="variable") >>> mindspore.ops.assign(variable, value) >>> print(variable.asnumpy()) [2.]