hanbt / learn_dl

Deep learning algorithms source code for beginners
Apache License 2.0
1.2k stars 988 forks source link

fc.py中backward这个方法有问题么?self.input是不是应该改成self.output #14

Closed sisyphusking closed 6 years ago

sisyphusking commented 6 years ago
def backward(self, delta_array):
    '''
    反向计算W和b的梯度
    delta_array: 从上一层传递过来的误差项
    '''
    # 式8
    self.delta = self.activator.backward(self.input) * np.dot(      # 为什么这里是input 而不是output呢?
        self.W.T, delta_array)   
    self.W_grad = np.dot(delta_array, self.input.T)
    self.b_grad = delta_array
ghost commented 6 years ago

应该是笔误了,应该是self.delta = self.activator.backward(self.activator.forward(input)) * np.dot( self.W.T, delta_array)才对。