Hi ptrblck,
Thank you for answering my question. I calculate the training loss and the validation loss after training and evaluation immediately. The code is as follow.
avg_train_losses = []
avg_valid_losses = [] 

for epoch in range(1, EPOCH + 1):
       
        train_losses = []
        valid_losses = []
        
        ###################
        # train the model #
        ###################
        model.train() # prep model for training
        for step, (x, batch_label) in enumerate(train_loader):
            batch_x = x.view(-1, 1*input_layer)   # batch x, shape (batch, 1*input_layer)
            batch_y = x.view(-1, 1*input_layer)   # batch y, shape (batch, 1*input_layer)
            
            batch_x = Variable(batch_x).to(device)
            batch_y = Variable(batch_y).to(device)
            batch_label = Variable(batch_label).to(device)
            
            ### forward        
            encoded, decoded = model(batch_x)
            loss =  loss_func_decode(decoded, batch_y) 
            
            ### backward
            optimizer.zero_grad()               # clear gradients for this training step
            loss.backward()                     # backpropagation, compute gradients
            
            # perform a single optimization step (parameter update)
            optimizer.step()     
            
            # record training loss
            train_losses.append(loss.item())
            
            if step % 100 == 0:
                print('Epoch: ', epoch, '| train loss: %.4f' % loss.cpu().data.numpy())
        
        ######################    
        # validate the model #
        ######################
        model.eval() # prep model for evaluation
        for x, batch_label in val_loader:
            batch_x = x.view(-1, 1*input_layer)   # batch x, shape (batch, 1*input_layer)
            batch_y = x.view(-1, 1*input_layer)   # batch y, shape (batch, 1*input_layer)
            
            batch_x = Variable(batch_x).to(device)
            batch_y = Variable(batch_y).to(device)
            batch_label = Variable(batch_label).to(device)
            
            # forward pass: compute predicted outputs by passing inputs to the model
            encoded, decoded = model(batch_x)
            # calculate the loss
            loss = loss_func_decode(decoded, batch_y)
            # record validation loss
            valid_losses.append(loss.item())
        
        # print training/validation statistics 
        # calculate average loss over an epoch
        train_loss = np.around(np.average(train_losses), decimals = 6)
        valid_loss = np.around(np.average(valid_losses), decimals = 6)
        avg_train_losses.append(train_loss)
        avg_valid_losses.append(valid_loss)