I think I didn’t state the problem clearly . In my codes, there are three forward steps and one backward step in each epoch like this:
for epoch in range(n):
    list = []
    list.append(model(x1)['logit'][0])
    list.append(model(x2)['logit'][0])
    list.append(model(x3)['logit'][0])
    loss = loss_cal(torch.cat(list).reshape(a,b,c))
    loss.backward()  #increase about 10GB
    #... ( the code like step() and zero_grad())
    torch.cuda.empty_cache()  #decrease about 2GB
    del loss  # nothing change

And it can savely run the epoch 1 with the memory increasing about 10GB because I have enough memory right now(20GB/32GB), but the next epoch when I call the loss.backward(), OOM will happen.