you can look at the default_collate function if it handles None or not.
Or you can give a custom collate function to your DataLoader which will handle None:

  
      github.com
  
  
    pytorch/pytorch/blob/master/torch/utils/data/dataloader.py#L32 418

_use_shared_memory = False
"""Whether to use shared memory in default_collate"""




class ExceptionWrapper(object):
"Wraps an exception plus traceback to communicate across threads"


def __init__(self, exc_info):
    self.exc_type = exc_info[0]
    self.exc_msg = "".join(traceback.format_exception(*exc_info))




def _worker_loop(dataset, index_queue, data_queue, collate_fn, seed, init_fn, worker_id):
global _use_shared_memory
_use_shared_memory = True


# Intialize C side signal handlers for SIGBUS and SIGSEGV. Python signal
# module's handlers are executed after Python returns from C low-level
# handlers, likely when the same fatal signal happened again already.
# https://docs.python.org/3/library/signal.html Sec. 18.8.1.1
_set_worker_signal_handlers()



  
  
    
    
  
  



  
      github.com
  
  
    pytorch/pytorch/blob/master/torch/utils/data/dataloader.py#L61-L84 233





def _worker_manager_loop(in_queue, out_queue, done_event, pin_memory, device_id):
if pin_memory:
    torch.cuda.set_device(device_id)


while True:
    try:
        r = in_queue.get()
    except Exception:
        if done_event.is_set():
            return
        raise
    if r is None:
        break
    if isinstance(r[1], ExceptionWrapper):
        out_queue.put(r)
        continue
    idx, batch = r
    try:


  This file has been truncated. show original