I can't plot images with make_grid

I have a dataset of images in the “dataset” and was trying to use “make_grid” like in this link: Training a Classifier — PyTorch Tutorials 1.8.1+cu102 documentation", but but there’s something wrong and I don’t know what.

dataiter = iter(dataset)
images, labels = dataiter.next()
    # show images

My dataset contains 3 images of shape (3, 40, 40).
The error is:

AttributeError                            Traceback (most recent call last)
<ipython-input-92-0a9e2d56a78a> in <module>
      1 dataiter = iter(dataset)
----> 2 images, labels = dataiter.next()
      3 plt.imshow(torchvision.utils.make_grid(images.permute(1,2,0)))
      4     # show images

AttributeError: 'iterator' object has no attribute 'next'

Did you mean to use images, labels = next(dataiter) by chance?