Extract tensors from custom class into one big tensor

I need to extract every 0th and 2nd Tensor from chunks.fulldata and put them in two separate Tensors (features and targets) that can be loaded into Pytorch’s DataLoader - what’s the best way to do this? I’m sure there’s some simple way to do this, but I’m new to this, so I’m kind of lost here

Based on your screenshot it looks like fulldata is a tuple containing 43 tensors.
I’m not sure, how you would like to split this tuple, but this would be one way:

fulldata = tuple(torch.randn(1) for _ in range(100))
features = torch.stack(fulldata[::2])
targets = torch.stack(fulldata[1::2])
1 Like