set_as
Description
Sets a Tensor.
Prototype
set_as(value, dst_offset=0, src_offset=None)
Parameters
Applicability
Restrictions
- To set a Tensor to a Scalar value, they must be of the same data type.
- The destination Tensor must be in the scope_ubuf scope.
- Only the first element of the destination Tensor is changed.
- Setting a Tensor of type int/uint to an Expr value is supported only when the Expr's Scalar is of type int or uint and the Expr's immediate is of type int or float.
For the
Atlas training product , setting a Scalar of type float16 to an Expr value is not supported.For the
Atlas inference product AI Core, setting a Scalar of type float16 to an Expr value is not supported.For the
Atlas inference product Vector Core, setting a Scalar of type float16 to an Expr value is not supported.For the
Atlas A2 training product /Atlas A2 inference product , setting a Scalar of type float16 to an Expr value is not supported.For the
Atlas 200I/500 A2 inference product , setting a Scalar of type float16 to an Expr value is not supported.
Returns
None
Example
from tbe import tik
tik_instance = tik.Tik()
data_A = tik_instance.Tensor("float16", (128,), name="data_A", scope=tik.scope_ubuf)
data_B = tik_instance.Tensor("float16", (128,), name="data_A", scope=tik.scope_ubuf)
data_A[0].set_as(data_B[0:1])