Welcome to the PyTorch community! 
It’s a bit hard to tell the context without seeing the rest of your code. Also, I’m not sure what kind of wrapping fast.ai has done, but this could be coming from their library.
The typical way to interact with datasets in PyTorch looks like something like this:
>>> mnist = MNIST(r"some root directory", download=True, train=True, transform=ToTensor())
>>> data = DataLoader(mnist)
>>> for num, (input, label) in enumerate(data):
...     print(num)

data in this case, an instance of the DataLoader class is itself an iterator. You can use normal python looping constructs on this. You shouldn’t have to call .next() directly.