Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: len() of a 0-d tensor #4

Open
Jayashree-Pougajendy opened this issue Jun 23, 2020 · 1 comment
Open

TypeError: len() of a 0-d tensor #4

Jayashree-Pougajendy opened this issue Jun 23, 2020 · 1 comment

Comments

@Jayashree-Pougajendy
Copy link

Hi,
I am facing the foll. issue using the pytorch, torchvision, and PIL versions (because of compatibility requirement with cuda 10.1) as:
torch: 1.4.0
torchvision: 0.5.0
PIL: 5.2.0

Traceback (most recent call last):
File "./main.py", line 186, in
cuda=cuda
File "/home/js/DGR_pytorch/train.py", line 102, in train
collate_fn=collate_fn,
File "/home/js/DGR_pytorch/dgr.py", line 130, in train_with_replay
collate_fn=collate_fn,
File "/home/js/DGR_pytorch/dgr.py", line 205, in _train_batch_trainable_with_replay
callback(trainable, progress, batch_index, result)
File "/home/js/DGR_pytorch/train.py", line 157, in cb
result['g_loss'], 'generator g loss', iteration, env=env
File "/home/js/DGR_pytorch/visual.py", line 87, in visualize_scalar
[name], name, iteration, env=env
File "/home/js/DGR_pytorch/visual.py", line 92, in visualize_scalars
assert len(scalars) == len(names)
File "/home/js/anaconda3/envs/env_con/lib/python3.5/site-packages/torch/tensor.py", line 445, in len
raise TypeError("len() of a 0-d tensor")
TypeError: len() of a 0-d tensor

Kindly suggest an alternative. Thank you.

@luoluo14
Copy link

I would like to ask whether the problem has been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants