
If this default is incorrect, you may use an extra "encoding"
     keyword argument to specify how these objects should be loaded,
     e.g., "encoding='latin1'" decodes them to strings using "latin1"
     encoding, and "encoding='bytes'" keeps them as byte arrays which
     can be decoded later with "byte_array.decode(...)".

-[ Example ]-



torch.load('tensors.pt')
   # Load all tensors onto the CPU
torch.load('tensors.pt', map_location=torch.device('cpu'))
   # Load all tensors onto the CPU, using a function
torch.load('tensors.pt', map_location=lambda storage, loc: storage)
   # Load all tensors onto GPU 1
torch.load('tensors.pt', map_location=lambda storage, loc: storage.cuda(1))
   # Map tensors from GPU 1 to GPU 0
torch.load('tensors.pt', map_location={'cuda:1': 'cuda:0'})
   # Load tensor from io.BytesIO object
with open('tensor.pt', 'rb') as f:
   ...     buffer = io.BytesIO(f.read())
torch.load(buffer)


