Custom Loss, referring to past y_pred values

I want to create a loss function that is able to do ~ this:

> def loss(last_ref , ref, last_ypred, y_pred):
>     last = last_ref + last_ypred
>     now = ref + y_pred
>     return pow(now - last, 2)

It is not clear (to me!) how to do this. I am just trying my 1st crack at moving to PyTorch. Thanks in advance for any thoughts.


weak question!