mindspore.ops.assign_add
- mindspore.ops.assign_add(variable, value)[source]
Updates a parameter or tensor by adding a value to it.
Support implicit type conversion and type promotion.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> variable = mindspore.Parameter([1], name="global_step") >>> value = mindspore.tensor([100], dtype=mindspore.int32) >>> mindspore.ops.assign_add(variable, value) >>> print(variable.asnumpy()) [101]