tcp.round - rounds the input value, with halfway cases rounded away from zero.
tcp.round_even - rounds in the input value, with halfway cases rounded to the nearest even integer.
This PR includes the following:
The definition of the two ops in Tcp for rounding.
Lowering from TorchToTcp for the torch.round op.
Lowerings from TcpToLinalg for both the Tcp rounding ops.
Lit tests for the ops and their lowerings.
AOT tests for both the Tcp rounding ops.
Since torch.round rounds halfway cases to even, it maps directly to tcp.round_even. There is no direct way to represent the other case (rounding away from zero) in PyTorch.
The AOT test for tcp.round_even is through torch.round, whereas the AOT test for tcp.round is from a Tcp IR representation.
This PR adds two Tcp ops for rounding.
tcp.round
- rounds the input value, with halfway cases rounded away from zero.tcp.round_even
- rounds in the input value, with halfway cases rounded to the nearest even integer.This PR includes the following:
torch.round
op.Since
torch.round
rounds halfway cases to even, it maps directly totcp.round_even
. There is no direct way to represent the other case (rounding away from zero) in PyTorch.The AOT test for
tcp.round_even
is throughtorch.round
, whereas the AOT test fortcp.round
is from a Tcp IR representation.