Skip to content
fn

round_op

→TensorImplPtr
int round_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Element-wise round-to-nearest-even — returns a new tensor whose values are round(a) with the same shape and dtype as a.

Differentiable with a zero gradient, as the reference keeps it.

Math

yi=round⁡(xi)y_i = \operatorname{round}(x_i) (round-half-to-even / banker's rounding).

Shape

Output shape equals input shape (elementwise).

See Also

floor_op, ceil_op.

Parameters

aTensorImplPtr
Input tensor. Integer dtypes are returned unchanged.

Returns

TensorImplPtr

New tensor with rounded values; same shape, dtype, and device as a.