scalar_sqrt

Description

Extracts the square root of a Scalar:

Prototype

scalar_sqrt(dst, src)

Parameters

Table 1 Parameter description

Parameter

Input/Output

Description

dst

Output

Destination operand. Has the same data type as the source operand.

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

Atlas Training Series Product : a Scalar of type int64/float32

src

Input

Source operand.

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/float32 or an immediate of type int64/float32

Applicability

Atlas 200/300/500 Inference Product

Atlas Training Series Product

Restrictions

A negative value is supported. The absolute value must be obtained before the square root.

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")
# Set src_scalar to 10.
src_scalar.set_as(10)
# After the command is executed, the value of dst_scalar is 3.
tik_instance.scalar_sqrt(dst_scalar, src_scalar)
tik_instance.BuildCCE(kernel_name="run_scalar_sqrt", inputs=[], outputs=[])