Hello @ptrblck ,
I kept the initial indexing of self. dataset. But I did not understand for a sampling of a dataset into 4 tensors  (2 data and 2 target tensors). How should I do it in PyTorch?
As I have 21600 images in a single folder and respective train.csv, val.csv,test.csv.
   def __init__(self, dataset):
        super().__init__()
        self.dataset = dataset

After this how should I sample?
self.dataset=dataset
class Siamese(Dataset):

    def __init__(self,dataset):

        super().__init__()
        self.dataset=dataset
        self.data0 = ??
        self.data1 = ??
        self.target0 = ??
        self.target1 = ??

and also If I sample it into 4 tensor while returning
    def __len__(self):
        return len(self.data0)

it gives me an error
TypeError: object of type 'module' has no len()