Pytorch 1.1.0
import torch
import torch.nn as nn
x_t=torch.rand((100,1,64,64))
x_t_hat=torch.rand((100,1,64,64))
loss_REC = nn.MSELoss(reduction=‘sum’)
loss_REC_mean = nn.MSELoss(reduction=‘mean’)
L = loss_REC(x_t_hat, x_t)/float(1006464) # The shape of x_t is [100, 1, 64, 64]
L_mean = loss_REC_mean(x_t_hat, x_t)
print("L: ", L)
print("L_mean: ", L_mean)
L is the same as L_mean