mindspore/docs/api/api_python/ops/mindspore.ops.func_assign.rst

21 lines
877 B
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.assign
=====================
.. py:function:: mindspore.ops.assign(variable, value)
为网络参数赋值。
`variable``value` 遵循隐式类型转换规则,使数据类型一致。如果它们具有不同的数据类型,则低精度数据类型将转换为相对最高精度的数据类型。
参数:
- **variable** (Parameter) - 网路参数。 :math:`(N,*)` ,其中 :math:`*` 表示任意数量的附加维度其秩应小于8。
- **value** (Tensor) - 要分配的值shape与 `variable` 相同。
返回:
Tensor数据类型和shape与 `variable` 相同。
异常:
- **TypeError** - 如果 `variable` 不是Parameter。
- **TypeError** - 如果 `value` 不是Tensor。
- **RuntimeError** - 如果 `variable``value` 不支持参数的数据类型转换。