Skip to main content

ClikaRT::ops::round

function

round()

Tensor round(Tensor x, int64_t decimals = 0)

Elementwise rounding to decimals fractional digits.

decimals = 0 (default) rounds to integers; positive keeps that many fractional digits; negative rounds to tens, hundreds, ….

Parameters

  • x: the input tensor.
  • decimals: how many fractional digits to keep. Default 0.

Throws

  • ClikaRT::Error: when the input's dtype is not served for this operation (the machine-readable reason rides code_name()).

Returns: a new tensor, same shape and dtype as x.

auto y = ClikaRT::ops::round(x); // integers
auto c = ClikaRT::ops::round(x, 2); // cents

Declared in ClikaRT/compute/ops.h, line 5121