recip on sigmoid

This commit is contained in:
Joe Fioti
2025-10-31 10:40:29 -04:00
parent 1ccbafdd32
commit dca3c3bdda
2 changed files with 2 additions and 1 deletions

View File

@@ -0,0 +1 @@
use crate::*;

View File

@@ -168,7 +168,7 @@ impl GraphTensor {
/// The sigmoid activation function
pub fn sigmoid(self) -> GraphTensor {
// Based on https://github.com/tinygrad/tinygrad/blob/9d142430cbe61121c864c0015f1de83c94a7d2c0/tinygrad/mlops.py#L70
1. / (1. + (-self).exp())
(1. + (-self).exp()).reciprocal()
}
/// The swish (aka silu) activation function