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
https://raw.githubusercontent.com/fastai/fastai/master/fastai/metrics.py

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: