round_half_up

Description

Rounds half up raw_tensor to the nearest integer element-wise, away from 0. For example, –1.5 is rounded to –2, and 1.5 is rounded to 2.

Prototype

round_half_up(raw_tensor)

Parameters

raw_tensor: a tvm.tensor for the input tensor

Atlas training products: supports float16 and float32.

Atlas inference products: supports float16, float32, f162s8, f162u8, f162s32, and f322s32.

Atlas 200I/500 A2 inference products: supports float16 and float32.

Atlas A2 training products/Atlas A2 inference products: supports float16 and float32.

Atlas A3 training products/Atlas A3 inference products: supports float16 and float32.

Returns

res_tensor: result Tensor, tvm.tensor type

The default data type is int32. Data is output based on the specified output data type. For example, if the input data type is f162s8, the output data type is int8.

Restrictions

None

Applicable Models

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas A3 training products/Atlas A3 inference products

Example

from tbe import tvm
from tbe import dsl
shape = (1024,1024)
input_dtype = "float16"
data = tvm.placeholder(shape, name="data", dtype=input_dtype)
res = dsl.round_half_up(data)