TorchedUp
LearnBetaProblemsSystem DesignSoonPremium
TorchedUp
LearnBetaProblemsSystem DesignSoonPremium
←

202. Backprop: Sigmoid

Easy

Hand-derive the gradient of L = sum(sigmoid(x)) w.r.t. x.

Forward: y = 1 / (1 + exp(-x)). L = sum(y).

Implement:

  • sigmoid_forward(x) -> y
  • sigmoid_backward(x) -> dL/dx of the same shape

The classic identity: dy/dx = y * (1 - y). Use it to keep the backward cheap and numerically stable.

Math

σ(x)=1+e−x1​,σ′(x)=σ(x)(1−σ(x))

Related problems

  • Backprop: Sigmoid (PyTorch)easyPyTorch

Asked at

NumPy

import numpy as np

 

def sigmoid_forward(...):

    pass

🔒

Premium problem

Free accounts include problems #1–20. Upgrade to unlock the editor, hidden test cases, and reference solutions for every problem.

Upgrade to PremiumBack to problems

Already premium?