Solved by ptrblck in post #2 
              
              
                __len__ and __getitem__ are at the wrong indentation, thus not part of the Dataset class. 
Move them an indentation to the right and run your code again.