How do you use custom dataset with Pytorch?

I am trying to use a custom dataset with Pytorch and iterating with but am not able to get this to work. Has anyone have any experience with this?

The easiest approach is with ImageFolder, which works basically the same as keras: