pytorch
4058dedf - Replace log(1 + x) with log1p(x) (#92114)

Commit
3 years ago
Replace log(1 + x) with log1p(x) (#92114) `log1p` offers better precision near zero since `(1 + x) - 1` truncates any values less than the float epsilon to zero. For `soft_margin_loss` this also requires one fewer kernel invocation which for numel=1e7 gives me a 1.2x speedup on CUDA and a 1.1x speedup on CPU. Pull Request resolved: https://github.com/pytorch/pytorch/pull/92114 Approved by: https://github.com/ngimel, https://github.com/lezcano
Author
Committer
Parents
Loading