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 training product : a Scalar of type int64

Atlas inference product AI Core: a Scalar of type int64/float32

Atlas inference product Vector Core: a Scalar of type int64/float32

Atlas A2 training product / Atlas A2 inference product : a Scalar of type int64/float32

Atlas 200I/500 A2 inference product : a Scalar of type int64/float32

src

Input

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

Atlas training product : a Scalar of type int64 or an immediate of type int64

Atlas inference product AI Core: a Scalar of type int64/float32 or an immediate of type int64

Atlas inference product Vector Core: a Scalar of type int64/float32 or an immediate of type int64

Atlas A2 training product / Atlas A2 inference product : a Scalar of type int64/float32 or an immediate of type int64

Atlas 200I/500 A2 inference product : a Scalar of type int64/float32 or an immediate of type int64

Applicability

Atlas training product

Atlas inference product AI Core

Atlas inference product Vector Core

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference 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=[])