How to Solve NameError: name 'DataLoader' is not defined -- torch

Solution: Import the 'DataLoader' module

To Solve the error, add the following line to the top of your code.

from torch.utils.data import DataLoader

 

For more information:
Python torch DataLoader