mindspore.ops.Assign
- class mindspore.ops.Assign[source]
Assigns Parameter with a value.
Refer to
mindspore.ops.assign()
for more details.- Inputs:
variable (Parameter) - The Parameter. \((N,*)\) where \(*\) means, any number of additional dimensions, its rank should be less than 8.
value (Tensor) - The value to be assigned, has the same shape with variable.
- Outputs:
Tensor, has the same data type and shape as original variable.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> from mindspore import Tensor, ops >>> 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.]