The answer from @ptrblck should solve the problem. But to add more, the problem is in the following line:



 Ayush_Agarwal:

t_images,t_label=TrainLoader(


Here TrainLoader is a class, and you want to create an instance (object) from this class. I would change the name to TrainSet t avoid confusion with a loader. So, on the left-hand side there should be only one variable as an object created from the class TrainSet (not a tuple):
train_set = TrainSet(im_dir=train_im_dir,ann_dir=train_ann_dir,img_idx=t_lb,transform=transform)

Then, once you have created an instance of TrainSet, then should be able to use that in a for-loop to get samples.
Note that while the above works in an infinite loop that gives samples of size 1, you may also need to use torch.utils.data.DataLoader, to get batches of data instead of one sample at a time:
train_set = TrainSet(im_dir=train_im_dir,ann_dir=train_ann_dir,img_idx=t_lb,transform=transform)
train_loader = utils.data.DataLoader(dataset=train_set,
                                     batch_size=32,
                                     shuffle=True,
                                     num_workers=1) 

Then, you can get batches of data in a for loop:
for batch_x, batch_y in train_loader:
    print(batch_x.shape, batch_y.shape)