scalar_abs

Description

Obtains the absolute value of a Scalar:

Prototype

scalar_abs(dst, src)

Parameters

Table 1 Parameter description

Parameter

Input/Output

Description

dst

Output

Destination operand.

Atlas 200/300/500 Inference Product : a Scalar of type int64

Atlas Training Series Product : a Scalar of type int64

src

Input

Source operand. When src is a scalar, dst must have the same data type as src.

Atlas 200/300/500 Inference Product : a Scalar of type int64 or an immediate of type int64

Atlas Training Series Product : a Scalar of type int64 or an immediate of type int64

Applicability

Atlas 200/300/500 Inference Product

Atlas Training Series Product

Restrictions

None

Returns

None

Example

from tbe import tik
tik_instance = tik.Tik()
src_scalar = tik_instance.Scalar(dtype="int64")
dst_scalar = tik_instance.Scalar(dtype="int64")
# src_scalar=-10
src_scalar.set_as(-10)
# dst_scalar=10
tik_instance.scalar_abs(dst_scalar, src_scalar)
tik_instance.BuildCCE(kernel_name="run_scalar_abs", inputs=[], outputs=[])