Solved by ptrblck in post #2 
              
              
                If intermediate tensors in vocab_process need the device memory and will thus raise the OOM issue, your loop approach could work (assuming that vocab_process returns the right output for sub-tensors). 
Since Python uses function scoping you wouldn’t have to delete the intermediate tensors, as they w…