This is for training…
 for epoch in range(num_epochs):
       running_loss = 0
        for i,sample in enumerate(train_loader):
            .
            .
            .
            output = net(mr)
            optimizer.zero_grad()
            loss = criterion(ct,output)
            loss.backward()
            optimizer.step()
            running_loss += loss.item()
            mean_loss = running_loss/(i+1)


and this is for validation:
        for i, sample in enumerate(valid_loader):
            running_loss = 0
            with torch.no_grad():
                mr = sample[0].float().to(device)
                ct = sample[1].float().to(device)
                output = net(mr)
                loss = criterion(ct, output)
                running_loss += loss.item()
                mean_loss = running_loss / (i + 1)
                print(
                    'epoch: ...

1. from the code I am using above I am summing the loss per epoch in running_loss and the dividing it to get mean_loss per epoch.
2. I am using   criterion = nn.MSELoss() loss.
3. input size is 5,1,32,32,32 and trying to synthesize output.