Home > Software engineering >  pytorch transform.ToTensor() syntax error
pytorch transform.ToTensor() syntax error

Time:12-20

I am not sure why I am getting the syntax error when I wrote :

`data_transforms = {
         #YOUR CODE HERE
        "train": transforms.Compose([
            transforms.Resize(256),
            transforms.RandomAffine(scale = (0.9,1.1), translate(0.1,0.1) , degrees = 10),
            transforms.colorJitter (brightness = 0.5 , contrast=0.5 , saturation = 0.5 , hue = 0.5 ),
            transforms.RandomHorizontalFlip(0.5),
            transforms.RandomCrop(224)
            transforms.ToTensor(),
            transforms.normalize(mean , std),
        ])`

and the error is :

`E     File "/home/workspace/src/data.py", line 56
E       transforms.ToTensor(),
E                ^
E   SyntaxError: invalid syntax`

I want to load the data set but getting error

CodePudding user response:

You forgot to add a comma after : transforms.RandomCrop(224)

  • Related