TorchedUp
LearnBetaProblemsSystem DesignSoonPremium
TorchedUp
LearnBetaProblemsSystem DesignSoonPremium
←

2. Sigmoid

Easy

Implement the sigmoid activation function.

Signature: def sigmoid(x: np.ndarray) -> np.ndarray

sigmoid(0) = 0.5

Math

σ(x)=1+e−x1​

Related problems

  • Sigmoid (PyTorch)easyPyTorch

Asked at

Python 30/10 runs today

Output

Anything you print() in your code will show up here after you click Run.

Test Results

○zero input
○positive values
○large values🔒 Premium
○output is non-negative (sigmoid in [0,1])
○preserves argmax (monotonic increasing)
○sigmoid(0) = 0.5 exact
○3D batch (B=2, T=2, C=3) — element-wise works for any rank🔒 Premium