Default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found <class ‘NoneType’>
At some point you are either returning a mask, which is a np array, and None.
When the system tries to make a batch it fails (cannot compose arrays with None)
The simplest case is you to write your own collate function to return a list of elements instead of trying to batchify your output “mask”. Or return a mask of -1 values or something meaningful to you