carpedm20 / carpedm20/ENAS-pytorch

TypeError: iteration over a 0-d tensor

Open
#25 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.7k
Forks
486
PR merge metrics
No merged PRs in 30d

Description

I tried running:

`python main.py --network_type rnn --dataset ptb --controller_optim adam --controller_lr 0.00035 --shared_optim sgd --shared_lr 20.0 --entropy_coeff 0.0001`

But got:
```

2018-09-20 11:34:56,560:INFO::[*] Make directories : logs/ptb_2018-09-20_11-34-56
2018-09-20 11:35:01,015:INFO::regularizing:
2018-09-20 11:35:06,032:INFO::# of parameters: 146,014,000
2018-09-20 11:35:06,127:INFO::[*] MODEL dir: logs/ptb_2018-09-20_11-34-56
2018-09-20 11:35:06,128:INFO::[*] PARAM path: logs/ptb_2018-09-20_11-34-56/params.json
/home/phil/anaconda3/envs/conda_env/lib/python3.7/site-packages/torch/nn/functional.py:995: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead.
warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
/home/phil/anaconda3/envs/conda_env/lib/python3.7/site-packages/torch/nn/functional.py:1006: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.")
Traceback (most recent call last):
File "main.py", line 48, in
main(args)
File "main.py", line 34, in main
trnr.train()
File "/home/phil/devel/ENAS-pytorch/trainer.py", line 216, in train
self.train_shared()
File "/home/phil/devel/ENAS-pytorch/trainer.py", line 297, in train_shared
hidden = utils.detach(hidden)
File "/home/phil/devel/ENAS-pytorch/utils.py", line 130, in detach
return tuple(detach(v) for v in h)
File "/home/phil/devel/ENAS-pytorch/utils.py", line 130, in
return tuple(detach(v) for v in h)
File "/home/phil/devel/ENAS-pytorch/utils.py", line 130, in detach
return tuple(detach(v) for v in h)
File "/home/phil/devel/ENAS-pytorch/utils.py", line 130, in
return tuple(detach(v) for v in h)
File "/home/phil/devel/ENAS-pytorch/utils.py", line 130, in detach
return tuple(detach(v) for v in h)
File "/home/phil/anaconda3/envs/conda_env/lib/python3.7/site-packages/torch/tensor.py", line 381, in __iter__
raise TypeError('iteration over a 0-d tensor')
TypeError: iteration over a 0-d tensor

```

Running Pytorch 0.4.1 on Python 3.7 (also tried on python 3.6.6, pytorch 0.4.1 and had same issue)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the command from the report with PyTorch 0.4.1, then trace the call from trainer.py:297 through utils.py:130 in detach. Check the hidden-state values passed during train_shared and verify that training proceeds without the 0-d tensor iteration error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.