Lesson1.ipynb - Error - TypeError: torch.max received an invalid combination of arguments - got (numpy.ndarray, dim=int)

(MTAU) #22

just encountered this.
collating what worked for me.

update fastai/metrics.py to this version

def accuracy_np(preds, targs):
preds = np.argmax(preds, 1)
return (preds==targs).mean()

#then in the workbook, after
log_preds, y = learn.TTA()

probs = np.mean(np.exp(log_preds),0)
print (“accuracy_np(probs, y):”, accuracy_np(probs, y))
print (“metrics.log_loss(y, probs):”, metrics.log_loss(y, probs))

many thanks to pandeyaah for putting us on track.

note to self: keep up to date with Jeremies’ git updates :slight_smile:

(Carlos Perez) #23

Thanks a lot worked like a charm :wink:

(xuan) #24

Thank you.

(Stas Bekman) #25

This now has been fixed in the github repo: