I expand data in getitem, how can I stack it in collatefn?
from torch.utils.data import Dataset
import numpy as np

class BarDataset(Dataset):
    def __init__(self):
        self.data = list(np.random.rand(9))
        pass

    def __getitem__(self, idx):
        # some ops
        out = np.array([self.data[idx] * 2, self.data[idx] * 3])
        return out

    def __len__(self):
        return len(self.data)

train_dataset = BarDataset()

train_loader = torch.utils.data.DataLoader(
    train_dataset,
    batch_size=3,
    pin_memory=True
)

for item in train_loader:
    print(item) 
# len(train_loader) = 3, wants len(train_loader) = 3 * 2