I am running pytorch
0.3.0.post4
on Ubuntu 14.04 (conda 4.3.25, python 3.6.2, cuda 8.0).
Here is what I get when importing
torchvision.transforms
>>> from torchvision import transforms
>>> dir(transforms)
['CenterCrop',
'Compose',
'Image',
'ImageOps',
'Lambda',
'Normalize',
'Pad',
'RandomCrop',
'RandomHorizontalFlip',
'RandomSizedCrop',
'Scale',
'ToPILImage',
'ToTensor',
'__builtins__',
'__cached__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__spec__',
'division',
'math',
'np',
'numbers',
'random',
'torch',
'types']
As you can see most of the transforms currently documented are missing, resulting in AttributeError
s such as this one
>>> transforms.RandomResizedCrop(224)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-5275ac2684b6> in <module>()
----> 1 transforms.RandomResizedCrop(224)
AttributeError: module 'torchvision.transforms' has no attribute 'RandomResizedCrop'
Am I not using the latest pytorch version or am I missing something very basic here?
Thanks for the help in advance!
Thanks for the reply. I didn’t know torch
and torchvision
were different packages.
I tried running conda install torchvision -c soumith
which upgraded torchvision
from 0.1.8 to 0.1.9.
As far as I can see, googling around, the latest release is 0.2. Nowhere I could find a reference to 0.3.
Do you know how to upgrade properly?
I have tried to update torchvision by using the command line:
conda install torchvision -c soumith
then I got this :
Solving environment: done
# All requested packages already installed.
so i used the following commands in python shell :
from torchvision import transforms
dir(transforms)
then i got the list of function and found RandomSizedCroped
If conda cannot find the latest package, you could try to update conda with conda update conda
and then re-run the install command.
I think it’s almost the same, but while RandomSizedCrop
resizes the image to its original input size, you can specify the size to which it will be resized in RandomResizedCrop
.