Solved by siahuat0727 in post #2 
              
              
                I found the code snippet here: 


Also, according to the doc, torch.Storage.from_file 

If shared is True the file will be created if needed. 

Therefore, 
To create: 
# create.py
import torch

fname = 'tensor.pt'
storage = torch.LongStorage.from_file(fname, True, 40)
torch.LongTensor(storage).copy_…