hanbt / learn_dl

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

error #6

Open 18463105800 opened 7 years ago

18463105800 commented 7 years ago

When I used the fc.py to train the MINIST,it happened a error: File "D:\pycharm\project\fc.py", line 107, in calc_gradient ) * (label - self.layers[-1].output) ValueError: operands could not be broadcast together with shapes (10,) (10,300)

zwww7766 commented 7 years ago

I found that if the label is (10,1) can do subtraction

FlyingCat-fa commented 6 years ago

function backward should be modified: self.W_grad = np.array(mat(delta_array).T * mat(self.input))

I suggest you change the list format of the data(train and test) to an array type. np.array(data)