aws_lambda/pytorch/source/torch/jit/__init__.py
def save(m, f):
    """
        Saves a ScriptModule to a file.

        Args:
            m: a ScriptModule to save
            f: a file-like object (has to implement write and flush) or a string
               containing a file name

        .. warning::
            If you are using Python 2, torch.save does NOT support StringIO.StringIO
            as a valid file-like object. This is because the write method should return
            the number of bytes written; StringIO.write() does not do this.

            Please use something like io.BytesIO instead.

        Example:
            >>> m = torch.jit.ScriptModule()
            >>> # Save to file
            >>> torch.jit.save(m, 'scriptmodule.pt')
            >>> # Save to io.BytesIO buffer
            >>> buffer = io.BytesIO()
            >>> torch.jit.save(m, buffer)
    """
    if isinstance(f, str) or \
            (sys.version_info[0] == 2 and isinstance(f, unicode)) or \
            (sys.version_info[0] == 3 and isinstance(f, pathlib.Path)):
        m.save(f)
    else:
        ret = m.save_to_buffer()
        f.write(ret)

        Saves a ScriptModule to a file.

        Args:
            m: a ScriptModule to save
            f: a file-like object (has to implement write and flush) or a string
               containing a file name

        .. warning::
            If you are using Python 2, torch.save does NOT support StringIO.StringIO
            as a valid file-like object. This is because the write method should return
            the number of bytes written; StringIO.write() does not do this.

            Please use something like io.BytesIO instead.

        Example:
            >>> m = torch.jit.ScriptModule()
            >>> # Save to file
            >>> torch.jit.save(m, 'scriptmodule.pt')
            >>> # Save to io.BytesIO buffer
            >>> buffer = io.BytesIO()
            >>> torch.jit.save(m, buffer)
    
Saves a ScriptModule to a file.
Saves a ScriptModule to a file .
def save(m, f):
    if isinstance(f, str) or \
            (sys.version_info[0] == 2 and isinstance(f, unicode)) or \
            (sys.version_info[0] == 3 and isinstance(f, pathlib.Path)):
        m.save(f)
    else:
        ret = m.save_to_buffer()
        f.write(ret)
def save ( m , f ) : if isinstance ( f , str ) or ( sys . version_info [ 0 ] == 2 and isinstance ( f , unicode ) ) or ( sys . version_info [ 0 ] == 3 and isinstance ( f , pathlib . Path ) ) : m . save ( f ) else : ret = m . save_to_buffer ( ) f . write ( ret )
Saves a ScriptModule to a file.
Saves a ScriptModule to a file .
"""
        Saves a ScriptModule to a file.

        Args:
            m: a ScriptModule to save
            f: a file-like object (has to implement write and flush) or a string
               containing a file name

        .. warning::
            If you are using Python 2, torch.save does NOT support StringIO.StringIO
            as a valid file-like object. This is because the write method should return
            the number of bytes written; StringIO.write() does not do this.

            Please use something like io.BytesIO instead.

        Example:
            >>> m = torch.jit.ScriptModule()
            >>> # Save to file
            >>> torch.jit.save(m, 'scriptmodule.pt')
            >>> # Save to io.BytesIO buffer
            >>> buffer = io.BytesIO()
            >>> torch.jit.save(m, buffer)
    """
m
a ScriptModule to save
a ScriptModule to save
f
a file-like object (has to implement write and flush) or a string
containing a file name
a file - like object ( has to implement write and flush ) or a string containing a file name
examples
>>> m = torch.jit.ScriptModule()
>>> # Save to file
>>> torch.jit.save(m, 'scriptmodule.pt')
>>> # Save to io.BytesIO buffer
>>> buffer = io.BytesIO()
>>> torch.jit.save(m, buffer)
>>> m = torch . jit . ScriptModule () >>> # Save to file >>> torch . jit . save ( m ' scriptmodule . pt ' ) >>> # Save to io . BytesIO buffer >>> buffer = io . BytesIO () >>> torch . jit . save ( m buffer )