Thank you for your answer! Is it possible to say:
loss = criterion_mse(imgs_pred[:,:,21:-21,36:-36], imgs_gt[:,:,21:-21,36:-36])

if the images are 256 in height and 448 in width and the border is 21 on the top and bottom and 36 on the left and right? I tested, if it is valid syntax, and it seems to be.