AttributeError: 'torch.FloatTensor' object has no attribute 'ndim'
See original GitHub issueHowdy folks
relatively new to Python, numpy, PyTorch (come from C++ and Matlab).
I am using CUDA 9.1, Python 3.6, Torch 0.3.0.post4, running on Ubuntu 16.04 LTS and I am starting off as follows:
python train.py --arch segnet --dataset pascal --visdom True
And I get the error below when I want to invoke visdom (i.e. when I don’t include --visdom True, I don’t have this issue).
File "/home/bart/anaconda3/envs/pytorch-semseg/lib/python3.6/site-packages/visdom/__init__.py", line 438, in line
assert Y.ndim == 1 or Y.ndim == 2, 'Y should have 1 or 2 dim'
AttributeError: 'torch.FloatTensor' object has no attribute 'ndim'
Any suggestions anyone?
Thanks in advance
Galto
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
AttributeError: 'torch.FloatTensor' object has no attribute 'ndim ...
I am using CUDA 9.1, Python 3.6, Torch 0.3.0.post4, ... AttributeError: 'torch.FloatTensor' object has no attribute 'ndim' #63.
Read more >pytorch torch.Tensor object has not ndim attribute
I have one variable that is a torch.Tensor. When I try a_tensor.ndim it throws an error: "Attribute Error Tensor object has no attribute...
Read more >How to fix following error 'torch.FloatTensor' object has no ...
And this error means data and label already are tensors in GPU and you cloning them again into GPU using .to() method.
Read more >ImageCleaner causes AttributeError: 'Tensor' object has no ...
When I get to the 'Cleaning Up' section in the lesson the cell fails to run and gives me a AttributeError: 'Tensor' object...
Read more >Attributeerror: 'Tensor' Object Has No Attribute 'To_Sparse'
Running a simple program using Tensorflow import tensorflow as tf tf.add1 AttributeError: 'Tensor' object has no attribute 'numpy' see full image Igel helps ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the late response. I was not able to resolve it personally, but I did the thing scyoyo suggested and that fixed it. I also had to change some dimensions, as shown below:
I also encounter this problem, change the .cpu() to .numpy() would solve that. Not sure whether it’s because the code of visdom is updated from torch tensor to numpy array.