Data Loader NoneType has no len()

DataLoader is throwing, NoneType object has no len() error. Can anyone help

TypeError: Caught TypeError in DataLoader worker process 1.
Original Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 80, in default_collate
    if not all(len(elem) == elem_size for elem in it):
  File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 80, in <genexpr>
    if not all(len(elem) == elem_size for elem in it):
TypeError: object of type 'NoneType' has no len()

Based on the error message it seems as if the Dataset.__getitem__ method is returning the None object (or no return statement is used which would then return None by default).
Could you check that the Dataset.__getitem__ is indeed returning valid data?

Yeah you are right, thank you for the help @ptrblck