I’m not sure what shape and data type self.inputs and self.targets is, but would it work if you remove the list call and pass the arrays directly to the collate function, which will then create the list?