Memory usage increases at every iteration, for every epoch. (checked via nvidia-smi)
This is my main function now. I’m running it from jupyter notebook.
Tried with and without having data loaders in main
if __name__ == '__main__':
    
    train_data = torch.utils.data.TensorDataset(features_t,labels_t)
    train_loader = torch.utils.data.DataLoader(train_data, batch_size, shuffle=True)

    val_data = torch.utils.data.TensorDataset(features_v,labels_v)
    validation_loader = torch.utils.data.DataLoader(val_data, batch_size, shuffle=False)
    
    model = Net()
    if cuda:
        model = nn.DataParallel(model).cuda()

    optimizer = optim.Adam(model.parameters(), lr=0.00001,betas=(0.9, 0.999), weight_decay=0.0)
    
    %%time
    epochs = 6000

    losst, acct = [], []
    lossv, accv = [], []
    best_acc = 0.0
    for epoch in range(1, epochs + 1):

        train(epoch, losst, acct)
        a = validate(lossv, accv)
        print("Mean Class Acc" + str(a))

        is_best = a > best_acc
        best_acc = max(a, best_acc)
        save_checkpoint({
            'epoch': epoch + 1,
            'net':model,
            'state_dict': model.state_dict(),
            'best_prec1': best_acc,
            'optimizer' : optimizer.state_dict(),
        }, is_best)