Skip to content

SOL-120 bug? #15

@kdubovikov

Description

@kdubovikov

Solution 120 shows

1 class Sigmoid:
2 def forward(self,x):
3 self.x = x
4 return 1/(1+np.exp(-x))
5
6 def backward(self, grad):
7 grad_input = self.x*(1-self.x) * grad
8 return grad_input

While I think the correct code should be

def backward(self, grad):
    sigmoid_output = self.forward(self.x) 
    grad_input = sigmoid_output * (1 - sigmoid_output) * grad
    return grad_input

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions