misc.pkl_utils - Tools for serialization.

    • dump(_obj, file_handler, protocol=2, persistent_id=)[source]
    • Pickles an object to a zip file using external persistence.
    • obj (object) – The object to pickle.
    • file_handler (file) – The file handle to save the object to.
    • persistent_id (callable) – The callable that persists certain objects in theobject hierarchy to separate files inside of the zip file. For example,PersistentNdarrayID saves any to aseparate NPY file inside of the zip file.

    New in version 0.8.

    Note

    The final file is simply a zipped file containing at least one file,pkl, which contains the pickled object. It can contain any othernumber of external objects. Note that the zip files are compatible withNumPy’s numpy.load() function.

    • theano.misc.pklutils.(_f, persistent_load=)[source]
    • Load a file that was dumped to a zip file.

    Parameters:

    • f (file) – The file handle to the zip file to load the object from.

    New in version 0.8.

    • class theano.misc.pklutils.StripPickler(_file, protocol=0, extra_tag_to_remove=None)[source]
    • Subclass of Pickler that strips unnecessary attributes from Theano objects.

    Example of use:

    • class CompatUnpickler(_file)[source]
    • Allow to reload in python 3 some pickled numpy ndarray.

    New in version 0.8.

    Examples

    Loading and Saving