I guess the pass statement might create the issue.
In the case the cv.resize or torch.tensor operation is failing for any reason, you would pass this sample and might return None without raising any error (and thus the DataLoader will fail).
Could you raise a RuntimeError with a proper error message and check, why one of these two operations is failing?