tilus.Script.round

Contents

tilus.Script.round

Script.round(x, *, out=None)[source]

Round each element to the nearest integer.

This instruction rounds each element in the register tensor x to the nearest integer. The result is a new register tensor with the same dtype, shape, and layout as x. We use the “round-to-nearest-even” rounding mode. This means that if the fractional part of a number is exactly 0.5, it will be rounded to the nearest even integer.

Parameters:
  • x (RegisterTensor) – The register tensor to round.

  • out (RegisterTensor, optional) – The register tensor to store the result. If not provided, a new register tensor will be allocated.

Returns:

ret – The register tensor containing the rounded values of the elements in x. The shape and dtype of the output tensor will be the same as that of x.

Return type:

RegisterTensor