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