InputScalar
Description
Defines a scalar variable as the InputScalar type for operator implementation. In this case, the inputs argument of type InputScalar passed to the BuildCCE call is the value obtained at operator run time.
Prototype
InputScalar(dtype="int64", name="input_scalar")
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
dtype |
Input |
Data type of the InputScalar object. Must be one of the following data types: int8, uint8, int16, uint16, int32, uint32, int64, uint64, float16, float32 Defaults to int64. |
name |
Input |
A string specifying the name of the InputScalar object. Only digits, letters, and underscores (_) are allowed. However, the name must not start with a digit. Defaults to input_scalar. Ensure that the InputScalar variables have unique names. |
Applicability
Restrictions
None
Example
from tbe import tik
tik_instance = tik.Tik()
data_A = tik_instance.Tensor("float16", (128,), name="data_A", scope=tik.scope_gm)
data_B = tik_instance.Tensor("float16", (128,), name="data_B", scope=tik.scope_gm)
abc = tik_instance.InputScalar(dtype="int16", name="abc")
src_ub = tik_instance.Tensor("float16", (128,), name="src_ub", scope=tik.scope_ubuf)
dst_ub = tik_instance.Tensor("float16", (128,), name="dst_ub", scope=tik.scope_ubuf)
tik_instance.vec_abs(128, dst_ub, src_ub, abc, 8, 8)
tik_instance.BuildCCE(kernel_name="simple_add",inputs=[data_A,data_B,abc],outputs=[])