nncf/torch/exporter.py
def parse_format(save_format: str) -> Tuple[str, dict]:
        """
        Parse saving format to a short form and additional arguments.

        :param save_format: Saving format.

        :return
            str: short form of the save_format
            dict: additional arguments for exporter
        """
        if save_format.startswith(PTExporter._ONNX_FORMAT):
            split_format = save_format.split('_')
            opset = None

            if len(split_format) == 1:
                opset = PTExporter._ONNX_DEFAULT_OPSET
            elif len(split_format) == 2:
                opset = int(split_format[1])

            if opset is not None and opset <= 0:
                raise ValueError("Incorrect save_format, expected 'onnx' or 'onnx_<opset_version>'.")

            if opset != PTExporter._ONNX_DEFAULT_OPSET:
                nncf_logger.warning(
                    'Using {} ONNX opset version. Recommended version is {}.'.format(
                        opset, PTExporter._ONNX_DEFAULT_OPSET
                    )
                )

            return PTExporter._ONNX_FORMAT, {'opset_version': opset}
        return save_format, {}

        Parse saving format to a short form and additional arguments.

        :param save_format: Saving format.

        :return
            str: short form of the save_format
            dict: additional arguments for exporter
        
Parse saving format to a short form and additional arguments.
Parse saving format to a short form and additional arguments .
def parse_format(save_format: str) -> Tuple[str, dict]:
        if save_format.startswith(PTExporter._ONNX_FORMAT):
            split_format = save_format.split('_')
            opset = None
            if len(split_format) == 1:
                opset = PTExporter._ONNX_DEFAULT_OPSET
            elif len(split_format) == 2:
                opset = int(split_format[1])
            if opset is not None and opset <= 0:
                raise ValueError("Incorrect save_format, expected 'onnx' or 'onnx_<opset_version>'.")
            if opset != PTExporter._ONNX_DEFAULT_OPSET:
                nncf_logger.warning(
                    'Using {} ONNX opset version. Recommended version is {}.'.format(
                        opset, PTExporter._ONNX_DEFAULT_OPSET
                    )
                )
            return PTExporter._ONNX_FORMAT, {'opset_version': opset}
        return save_format, {}
def parse_format ( save_format : str ) -> Tuple [ str , dict ] : if save_format . startswith ( PTExporter . _ONNX_FORMAT ) : split_format = save_format . split ( '_' ) opset = None if len ( split_format ) == 1 : opset = PTExporter . _ONNX_DEFAULT_OPSET elif len ( split_format ) == 2 : opset = int ( split_format [ 1 ] ) if opset is not None and opset <= 0 : raise ValueError ( "Incorrect save_format, expected 'onnx' or 'onnx_<opset_version>'." ) if opset != PTExporter . _ONNX_DEFAULT_OPSET : nncf_logger . warning ( 'Using {} ONNX opset version. Recommended version is {}.' . format ( opset , PTExporter . _ONNX_DEFAULT_OPSET ) ) return PTExporter . _ONNX_FORMAT , { 'opset_version' : opset } return save_format , { }
Parse saving format to a short form and additional arguments.
Parse saving format to a short form and additional arguments .
"""
        Parse saving format to a short form and additional arguments.

        :param save_format: Saving format.

        :return
            str: short form of the save_format
            dict: additional arguments for exporter
        """
short form of the save_format
dict: additional arguments for exporter
short form of the save_format dict : additional arguments for exporter
str
save_format
str
None