nncf/experimental/tensorflow/quantization/quantizers.py
def create_quantizer(name: str,
                     qspec: TFQuantizerSpec,
                     is_weight_quantization: bool,
                     input_shape: Optional[List[int]] = None,
                     channel_axes: Optional[List[int]] = None):
    """
    Factory method to create quantizer.

    :param name: Name of the quantizer. Should be unique.
    :param qspec: Specification of the quantizer.
    :param is_weight_quantization: A boolean flag.
        Takes one of the following values:
            - `True` if input tensor of the quantizer is weights
            - `False` if input tensor of the quantizer is activations
    :param input_shape: Shape of the input tensor for which the
        quantization is applied. Required only for per-channel
        quantization.
    :param channel_axes: Axes numbers of the input tensor which
        correspond to its channels. Required only for per-channel
        quantization.
    :return: The instance of the `SymmetricQuantizerV2` or
        `AsymmetricQuantizerV2` class.
    """
    quantizer_cls = NNCF_QUANTIZATION_OPERATIONS_V2.get(qspec.mode)
    input_type = InputType.WEIGHTS if is_weight_quantization else InputType.INPUTS
    quantizer = quantizer_cls(name, qspec)
    quantizer.set_input_spec(input_type, input_shape, channel_axes)
    return quantizer

    Factory method to create quantizer.

    :param name: Name of the quantizer. Should be unique.
    :param qspec: Specification of the quantizer.
    :param is_weight_quantization: A boolean flag.
        Takes one of the following values:
            - `True` if input tensor of the quantizer is weights
            - `False` if input tensor of the quantizer is activations
    :param input_shape: Shape of the input tensor for which the
        quantization is applied. Required only for per-channel
        quantization.
    :param channel_axes: Axes numbers of the input tensor which
        correspond to its channels. Required only for per-channel
        quantization.
    :return: The instance of the `SymmetricQuantizerV2` or
        `AsymmetricQuantizerV2` class.
    
Factory method to create quantizer.
Factory method to create quantizer .
def create_quantizer(name: str,
                     qspec: TFQuantizerSpec,
                     is_weight_quantization: bool,
                     input_shape: Optional[List[int]] = None,
                     channel_axes: Optional[List[int]] = None):
    quantizer_cls = NNCF_QUANTIZATION_OPERATIONS_V2.get(qspec.mode)
    input_type = InputType.WEIGHTS if is_weight_quantization else InputType.INPUTS
    quantizer = quantizer_cls(name, qspec)
    quantizer.set_input_spec(input_type, input_shape, channel_axes)
    return quantizer
def create_quantizer ( name : str , qspec : TFQuantizerSpec , is_weight_quantization : bool , input_shape : Optional [ List [ int ] ] = None , channel_axes : Optional [ List [ int ] ] = None ) : quantizer_cls = NNCF_QUANTIZATION_OPERATIONS_V2 . get ( qspec . mode ) input_type = InputType . WEIGHTS if is_weight_quantization else InputType . INPUTS quantizer = quantizer_cls ( name , qspec ) quantizer . set_input_spec ( input_type , input_shape , channel_axes ) return quantizer
Factory method to create quantizer.
Factory method to create quantizer .
"""
    Factory method to create quantizer.

    :param name: Name of the quantizer. Should be unique.
    :param qspec: Specification of the quantizer.
    :param is_weight_quantization: A boolean flag.
        Takes one of the following values:
            - `True` if input tensor of the quantizer is weights
            - `False` if input tensor of the quantizer is activations
    :param input_shape: Shape of the input tensor for which the
        quantization is applied. Required only for per-channel
        quantization.
    :param channel_axes: Axes numbers of the input tensor which
        correspond to its channels. Required only for per-channel
        quantization.
    :return: The instance of the `SymmetricQuantizerV2` or
        `AsymmetricQuantizerV2` class.
    """
The instance of the `SymmetricQuantizerV2` or
`AsymmetricQuantizerV2` class.
The instance of the ` SymmetricQuantizerV2 ` or ` AsymmetricQuantizerV2 ` class .
name
str
Name of the quantizer. Should be unique.
Name of the quantizer . Should be unique .
qspec
TFQuantizerSpec
Specification of the quantizer.
Specification of the quantizer .
is_weight_quantization
bool
A boolean flag.
Takes one of the following values:
`True` if input tensor of the quantizer is weights
`False` if input tensor of the quantizer is activations
A boolean flag . Takes one of the following values : ` True ` if input tensor of the quantizer is weights ` False ` if input tensor of the quantizer is activations
input_shape
Optional[List[int]]
Shape of the input tensor for which the
quantization is applied. Required only for per-channel
quantization.
Shape of the input tensor for which the quantization is applied . Required only for per - channel quantization .
channel_axes
Optional[List[int]]
Axes numbers of the input tensor which
correspond to its channels. Required only for per-channel
quantization.
Axes numbers of the input tensor which correspond to its channels . Required only for per - channel quantization .