set_as
Description
Sets a Tensor.
Prototype
set_as(value, dst_offset=0, src_offset=None)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
value |
Input |
Value to set. Supported data types:
|
dst_offset |
Input |
Reserved and not recommended. |
src_offset |
Input |
Reserved and not recommended. |
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 200/300/500 Inference Product , setting a Scalar of type float16 or float32 to an Expr value is not supported.For the
Atlas Training Series 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])
Parent topic: Tensor Management