set_as
Description
Sets the value of a Scalar.
Prototype
set_as(value, src_offset=None)
Parameters
Applicability
Restrictions
For the
For the
For the
For the
For the
Returns
None
Example
from tbe import tik
tik_instance = tik.Tik()
# Immediate: int
index_reg = tik_instance.Scalar(dtype = "int32")
index_reg.set_as(10)
# Immediate: float
index_reg2 = tik_instance.Scalar(dtype = "float16")
index_reg2.set_as(10.2)
# A Scalar variable
index_reg3 = tik_instance.Scalar(dtype = "float16")
index_reg3.set_as(index_reg2)
# A Tensor value
data_A = tik_instance.Tensor("float16", (128,), name="data_A", scope=tik.scope_ubuf)
index_reg3.set_as(data_A[0])// tensor value
#An Expr
index_reg4 = tik_instance.Scalar(dtype = "int32")
index_reg4.set_as(index_reg+20)