dutZ1855 commented on issue #18590:
URL: https://github.com/apache/tvm/issues/18590#issuecomment-3666010040
The ONNX `Round` node is imported as `relax.op.round`:
- `tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py` (`class Round`
returns `relax.op.round(inputs[0])`)
Relax registers `round` as a unary op:
- `tvm/src/relax/op/tensor/unary.cc`
(`RELAX_REGISTER_UNARY_ARITH_OP_AND_IMPL(round, ...)`)
For LLVM target, `tir.round` is lowered to `llvm.round`
(ties-away-from-zero), which explains `Round(0.5)==1`:
- `tvm/src/target/llvm/intrin_rule_llvm.cc` (`TVM_REGISTER_OP("tir.round")
... ::llvm::Intrinsic::round`)
TVM also has `tir.nearbyint` (`::llvm::Intrinsic::nearbyint`) which
typically corresponds to “round-to-nearest, ties-to-even” under default IEEE
rounding mode, but ONNX `Round` currently does not take that path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]