Fix to cuda error

This commit is contained in:
2025-11-25 10:06:46 +01:00
parent c0b2545671
commit 8098d6282d
2 changed files with 26 additions and 2 deletions
+14
View File
@@ -172,6 +172,20 @@ def collate_to_cuda(device):
return Xf, Xt, Y, Xc
return _collate
def collate_to_cpu(batch):
Xf, Xt, Y, Xc = zip(*batch)
Xf = torch.stack(Xf).cpu()
Xt = torch.stack(Xt).cpu()
Y = torch.stack(Y).cpu()
if Xc[0] is not None:
Xc = torch.stack(Xc).cpu()
else:
Xc = None
return Xf, Xt, Y, Xc
class EvenlySpacedDataset(BaseDataset):
def __init__(