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
While running the sample script ./bin/rtho.py, using README provided command the following error occurs. python bin/baselines.py --network vgg --dataset cifar_10 --optimizer sgd --momentum 0.9 --lr-scheduler cyclic
Traceback (most recent call last): File "bin/rtho.py", line 125, in <module> train_rtho(args.network, args.dataset, args.num_epoch, args.batch_size, args.optimizer, args.lr, args.momentum, File "bin/rtho.py", line 92, in train_rtho hyper_optim.compute_hg(net, first_grad) File "/home/tyu/sandbox/original_adatune/adatune/adatune/mu_sgd.py", line 68, in compute_hg hvp_flatten = torch.cat([h.view(-1) for h in hvp]) File "/home/tyu/sandbox/original_adatune/adatune/adatune/mu_sgd.py", line 68, in <listcomp> hvp_flatten = torch.cat([h.view(-1) for h in hvp]) RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
Same error reported when using adam, in mu_adam.py
Changing line 68 in mu_sgd.py into the following by adding contiguous, fixed the problem and can see the script running. hvp_flatten = torch.cat([h.contiguous().view(-1) for h in hvp])
It will be good if you can advise whether this will be a correct fix?
The text was updated successfully, but these errors were encountered:
I'm also getting this error, and I can confirm that it was resolved by changing view(-1) to reshape(-1).
And just so my PyTorch version is recorded here:
Team,
While running the sample script ./bin/rtho.py, using README provided command the following error occurs.
python bin/baselines.py --network vgg --dataset cifar_10 --optimizer sgd --momentum 0.9 --lr-scheduler cyclic
Traceback (most recent call last): File "bin/rtho.py", line 125, in <module> train_rtho(args.network, args.dataset, args.num_epoch, args.batch_size, args.optimizer, args.lr, args.momentum, File "bin/rtho.py", line 92, in train_rtho hyper_optim.compute_hg(net, first_grad) File "/home/tyu/sandbox/original_adatune/adatune/adatune/mu_sgd.py", line 68, in compute_hg hvp_flatten = torch.cat([h.view(-1) for h in hvp]) File "/home/tyu/sandbox/original_adatune/adatune/adatune/mu_sgd.py", line 68, in <listcomp> hvp_flatten = torch.cat([h.view(-1) for h in hvp]) RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
Same error reported when using adam, in mu_adam.py
Changing line 68 in mu_sgd.py into the following by adding contiguous, fixed the problem and can see the script running.
hvp_flatten = torch.cat([h.contiguous().view(-1) for h in hvp])
It will be good if you can advise whether this will be a correct fix?
The text was updated successfully, but these errors were encountered: