Issue
This is the block of code where am getting this error:
train_transforms = transforms.Compose([transforms.RandomRotation(30),
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5],
[0.5, 0.5, 0.5])])
I've tried updating my torchvision but had no luck!
Solution
The problem is that you have a variable called transforms
after from torchvision import transforms
which has a compose of a certain type. This override the transform you import from the torchvison
. Therefore when you run the above code it calls the transforms which is a variable
not the one from torchvision
module.
It is advisable to rename the variable or if you are using jupyter notebook run the cell where you import transforms
before running the cell with the code above.
Answered By - Rose W.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.