Solved by kshitij in post #5 
              
              
                def model_a_step():
    # instantiate dataloader and dataset
    a_dataset = Dataset(model_a_data_set)
    dataloader = DataLoader(a_dataset)

    for x in dataloader:
        # run inference and backprop
    
    # no need as they will be destroyed when function ends.
    # destroy dataloader and d…