Hi everyone, if I want to print epoch loss (i.e. loss after every 300 epochs) then how should I modify this code?
And what is difference between running and epoch loss?
Thanks in advance
def train_model(train_dl, model):
    criterion = MSELoss()                                               #loss function
    optimizer = Adam(model.parameters(), lr=0.001, betas=(0.9, 0.999))  #optimizer should be used
    for epoch in range(300):
        running_loss = 0.0
        for i, (inputs, targets) in enumerate(train_dl):
            optimizer.zero_grad()
            pred = model(inputs)
            loss = criterion(pred, targets)
            loss.backward()
            optimizer.step()
            #print ("loss.item",loss.item())
            running_loss +=loss.item()
            epoch_loss += pred.shape[0]*loss.item()
    print('Finished Training')