That’s not a bug, sorry, I should have explained. My model uses  xt , which are patches of images, and  xtk , which are ‘future’ patches or predictions, that is, a different random patch of the same image but with some displacement. Variable  yt  represents the labels but it was meant to be there for an evaluation of the accuracy when testing, the labels are not used in this custom loss. Variable  yt  can be ignored in this post.