Invalid syntax error when setting root = to in PyTorch
import torchvision
from torchvision import transforms
train_data_path=&quot;./train/&quot;
transforms = transforms.Compose([
transforms.Resize(64),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225] )
])
train_data = torchvision.datasets.ImageFolder
(root=train_data_path,transform=transforms)

This is the error message:
File &quot;&lt;ipython-input-4-e470172b3902&gt;&quot;, line 8
    (root=train_data_path,transform=transforms)
         ^
SyntaxError: invalid syntax

How would I be able to fix this?

You need the opening parentheses to be directly connected to the function, without any whitespace separating them. Try replacing the final two lines with:
train_data = torchvision.datasets.ImageFolder(
    root=train_data_path, transform=transforms
)


