The PyTorch serialization format is built off of pickle (.pkl) but overrides some functionality to handle tensors that share the same backing storage.

  
      github.com
  
  
    pytorch/pytorch/blob/master/torch/serialization.py 298
import difflib
import inspect
import os
import shutil
import struct
import sys
import torch
import tarfile
import tempfile
import warnings
from contextlib import closing, contextmanager
from ._utils import _import_dotted_name
from ._six import string_classes as _string_classes
if sys.version_info[0] == 2:
    import cPickle as pickle
else:
    import pickle
    import pathlib

DEFAULT_PROTOCOL = 2


  This file has been truncated. show original