Thank you very much for your prompt reply sir. I have defined the following function for estimating the accuracy of the designed model
def get_accuracy(SR,GT,threshold=0.5):
SR = SR > threshold

GT = GT == torch.max(GT)

corr = torch.sum(SR==GT)

tensor_size = SR.size(0)*SR.size(1)*SR.size(2)*SR.size(3)

acc = float(corr)/float(tensor_size)

return acc

I have added the following lines to my codes
out = model(x)
    out = F.log_softmax(out, dim=1)  # (b, n, h, w)

    loss = criterion(out, y_true)

    # backward

    optimizer.zero_grad()

    loss.backward()

    optimizer.step()

    train_loss += loss.item()

    label_pred = out.max(dim=1)[1].data.cpu().numpy()

    label_true = y_true .data.cpu().numpy()

    acc= get_accuracy(label_true,label_pred)

    print(acc)

I got the following error after running
TypeError: max(): argument ‘input’ (position 1) must be Tensor, not numpy.ndarray