I have a custom Dataset:
class MyDataset(Dataset):
    def __init__(self, data, window):
        self.data = data
        self.window = window
        self.shape = self.__getshape__()
        self.size = self.__getsize__()

    def __getitem__(self, index):
        x = self.data[index:index+self.window]
        y = self.data[index+self.window]
        return x, y

    def __len__(self):
        return len(self.data) -  self.window 
    
    def __getshape__(self):
        return (self.__len__(), *self.__getitem__(0)[0].shape)
    
    def __getsize__(self):
        return (self.__len__())

I want to be able to have it copied to an alternate device (such as Cuda)
my_array = np.arange(100)
my_dataset=MyDataset(my_array,10)
my_loader = torch.utils.data.DataLoader(my_dataset, batch_size=20, shuffle = False, drop_last=True)
for data, target in my_loader.to(device):

AttributeError: 'DataLoader' object has no attribute 'to'
Even though the error says “DataLoader”, I assume it means the Dataset, since I am using a standard DataLoader I always use (torch.utils.data.DataLoader), but I am using a custom Dataset.