Help me to make the code this simple loss

image

I tried to realize this loss using pytorch but as beginner it is difficult for me…
Can you make this operation to the pytorch code?
It could be very helpful for me.
Thank you.