Load the values x and y using the data loader.
Do a forward pass, and update the parameters.
I need to change some values of y based on some criterion, and I need to be able to sample from the new updated y from next iteration onwards.
You can do this when you get it from the DataLoader itself. Assume you have a training loop like this:
my_data_loader = torch.utils.data.DataLoader(dataset=dataset, batch_size=batch_size, shuffle=shuffle)`
for i, itr in enumerate(my_data_loader):
X, Y = itr
Y = my_function(Y)
# Do something