You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(cv2.7) gpuserver@ubuntu:~/ht/labs/temporal-ensembling$ python mnist_eval.py
Traceback (most recent call last):
File "mnist_eval.py", line 50, in
acc, acc_best, l, sl, usl, indices = train(model, seed, **cfg)
File "/home/gpuserver/ht/labs/temporal-ensembling/temporal_ensembling.py", line 86, in train
k, n_classes, seed, shuffle_train=False)
File "/home/gpuserver/ht/labs/temporal-ensembling/temporal_ensembling.py", line 25, in sample_train
indices[i * card: (i + 1) * card] = class_items[rd[:card]]
RuntimeError: expand(torch.LongTensor{[10, 1]}, size=[10]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
The text was updated successfully, but these errors were encountered:
Traceback (most recent call last):
File "mnist_eval.py", line 50, in
acc, acc_best, l, sl, usl, indices = train(model, seed, **cfg)
File "/storage/ssd/jupyter-nb-workspace/temporal-ensembling-master/temporal_ensembling.py", line 86, in train
k, n_classes, seed, shuffle_train=False)
File "/storage/ssd/jupyter-nb-workspace/temporal-ensembling-master/temporal_ensembling.py", line 25, in sample_train
indices[i * card: (i + 1) * card] = class_items[rd[:card]]
RuntimeError: expand(torch.LongTensor{[10, 1]}, size=[10]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
The error is a dimension mismatch and is due to breaking changes in PyTorch 0.4.0 and later. I used PyTorch 0.3.0.post4 version with torchvision version 0.2.0 to run my experiments.
I recommend to use the same version as I did, and will update the README so that users will know which version to use.
If you want to stick with the latest PyTorch version, in my case a very simple addition in temporal_ensembling.py did the job (line 22) : class_items = (train_dataset.train_labels == i).nonzero()[:, 0]
(cv2.7) gpuserver@ubuntu:~/ht/labs/temporal-ensembling$ python mnist_eval.py
Traceback (most recent call last):
File "mnist_eval.py", line 50, in
acc, acc_best, l, sl, usl, indices = train(model, seed, **cfg)
File "/home/gpuserver/ht/labs/temporal-ensembling/temporal_ensembling.py", line 86, in train
k, n_classes, seed, shuffle_train=False)
File "/home/gpuserver/ht/labs/temporal-ensembling/temporal_ensembling.py", line 25, in sample_train
indices[i * card: (i + 1) * card] = class_items[rd[:card]]
RuntimeError: expand(torch.LongTensor{[10, 1]}, size=[10]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
The text was updated successfully, but these errors were encountered: