How can I get target Y value in training stage

For some model, we need to use the target value in the training stage. But it looks the only way is to rewrite the data block. Is any advanced method can get the target value in training stage?