A repo for holding example code
149
stars
76
forks
source link
i have an error in 'Jp = xent(predp, labels).mean() + wd_term'. (IndexError Traceback (most recent call last) Cell In[52], line 1 ----> 1 dW_approx = get_grads((gcn1_out,), sm1, "W", labels, eps=1e-4, wd=opt.wd) 2 db_approx = get_grads((gcn1_out,), sm1, "b", labels, eps=1e-4, wd=opt.wd) Cell In[50], line 16 14 wd_term = wd/2*(cp_flat**2).sum() / labels.shape[0] 15 #print(wd_term) ---> 16 Jp = xent(predp, labels).mean() + wd_term 18 # J(theta - eps) 19 cp_flat[i] = theta - eps Cell In[47], line 8 7 def xent(pred, labels): #fonction de perte d'entropie croisée ----> 8 return -np.log(pred)[np.arange(pred.shape[0]), np.argmax(labels, axis=1)] IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (34,) (5,) ) #13
Open
yassir156 opened 8 months ago
issue in the Shape, i didn't change your code ,i just run it and it's give me this error.