round
in PyTorch is a “Python-like” round (std::nearbyint
) but not a “Cpp-like” round (std::round
). It means, round([-0.5, 0.5])
would return [0, 0]
but not [-1, 1]
. I need “Cpp-like” round, especially when deploying my model.
I check the source code and find
One year ago, I posted Is there any faster way to rounding a tensor? and found a temporary solution. But it is complex and inefficient.
Does PyTorch have a “Cpp-like” round function, or an option?
Thank you.
Read more here: Source link