Created
March 24, 2018 14:41
-
-
Save wpride/e99b9b565d387641977f6abafdd6c8ac to your computer and use it in GitHub Desktop.
numpy LongTensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
<ipython-input-11-2832d24508dc> in <module>() | |
1 lr = 5e-3 | |
----> 2 learn.fit(lr, 3, cycle_len=1) | |
~/fastai/courses/dl1/fastai/learner.py in fit(self, lrs, n_cycle, wds, **kwargs) | |
212 self.sched = None | |
213 layer_opt = self.get_layer_opt(lrs, wds) | |
--> 214 return self.fit_gen(self.model, self.data, layer_opt, n_cycle, **kwargs) | |
215 | |
216 def warm_up(self, lr, wds=None): | |
~/fastai/courses/dl1/fastai/learner.py in fit_gen(self, model, data, layer_opt, n_cycle, cycle_len, cycle_mult, cycle_save_name, best_save_name, use_clr, metrics, callbacks, use_wd_sched, norm_wds, wds_sched_mult, **kwargs) | |
159 n_epoch = sum_geom(cycle_len if cycle_len else 1, cycle_mult, n_cycle) | |
160 return fit(model, data, n_epoch, layer_opt.opt, self.crit, | |
--> 161 metrics=metrics, callbacks=callbacks, reg_fn=self.reg_fn, clip=self.clip, **kwargs) | |
162 | |
163 def get_layer_groups(self): return self.models.get_layer_groups() | |
~/fastai/courses/dl1/fastai/model.py in fit(model, data, epochs, opt, crit, metrics, callbacks, stepper, **kwargs) | |
104 i += 1 | |
105 | |
--> 106 vals = validate(stepper, data.val_dl, metrics) | |
107 if epoch == 0: print(layout.format(*names)) | |
108 print_stats(epoch, [debias_loss] + vals) | |
~/fastai/courses/dl1/fastai/model.py in validate(stepper, dl, metrics) | |
126 preds,l = stepper.evaluate(VV(x), VV(y)) | |
127 loss.append(to_np(l)) | |
--> 128 res.append([f(preds.data,y) for f in metrics]) | |
129 return [np.mean(loss)] + list(np.mean(np.stack(res),0)) | |
130 | |
~/fastai/courses/dl1/fastai/model.py in <listcomp>(.0) | |
126 preds,l = stepper.evaluate(VV(x), VV(y)) | |
127 loss.append(to_np(l)) | |
--> 128 res.append([f(preds.data,y) for f in metrics]) | |
129 return [np.mean(loss)] + list(np.mean(np.stack(res),0)) | |
130 | |
~/fastai/courses/dl1/fastai/metrics.py in accuracy(preds, targs) | |
8 def accuracy(preds, targs): | |
9 preds = torch.max(preds, dim=1)[1] | |
---> 10 return (preds==targs).float().mean() | |
11 | |
12 def accuracy_thresh(thresh): | |
~/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/tensor.py in __eq__(self, other) | |
358 | |
359 def __eq__(self, other): | |
--> 360 return self.eq(other) | |
361 | |
362 def __ne__(self, other): | |
TypeError: eq received an invalid combination of arguments - got (numpy.ndarray), but expected one of: | |
* (int value) | |
didn't match because some of the arguments have invalid types: (numpy.ndarray) | |
* (torch.cuda.LongTensor other) | |
didn't match because some of the arguments have invalid types: (numpy.ndarray) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment