mirror of
https://github.com/ml-explore/mlx.git
synced 2025-10-21 18:28:11 +08:00
Precise sigmoid (#2659)
* bump patch * Sigmoid matches PyTorch and is more precise on tails
This commit is contained in:
@@ -309,8 +309,8 @@ struct Round {
|
||||
struct Sigmoid {
|
||||
template <typename T>
|
||||
T operator()(T x) {
|
||||
auto y = 1 / (1 + metal::exp(-metal::abs(x)));
|
||||
return (x < 0) ? 1 - y : y;
|
||||
auto y = 1 / (1 + metal::exp(metal::abs(x)));
|
||||
return (x < 0) ? y : 1 - y;
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user