def apply(self, model):
    '\n        Insert the `moving_average_abs_max_scale` layers to calculate the\n        output scales for specific layers in the dygraph model.\n\n        Args:\n            model(paddle.nn.Layer): The target model which would be\n                calculate the output quantization scale.\n\n        Returns:\n            None\n        '
    assert isinstance(model, dygraph.Layer), 'The model must be the instance of dygraph.Layer.'
    for (cur_name, cur_layer) in model.named_sublayers():
        if ('_act_preprocess' in cur_name):
            continue
        if (not self._is_target_layer(cur_layer)):
            continue
        (parent_layer, sub_name) = utils.find_parent_layer_and_sub_name(model, cur_name)
        if isinstance(cur_layer, tuple(utils.fake_quant_output_layers)):
            cur_quant_layer = quant_layers.FakeQuantMAOutputScaleLayer(cur_layer, self._moving_rate)
        else:
            cur_quant_layer = quant_layers.MAOutputScaleLayer(cur_layer, self._moving_rate)
        setattr(parent_layer, sub_name, cur_quant_layer)
Insert the `moving_average_abs_max_scale` layers to calculate the
output scales for specific layers in the dygraph model.

Args:
    model(paddle.nn.Layer): The target model which would be
        calculate the output quantization scale.

Returns:
    None
def apply(self, model):
    '\n        Insert the `moving_average_abs_max_scale` layers to calculate the\n        output scales for specific layers in the dygraph model.\n\n        Args:\n            model(paddle.nn.Layer): The target model which would be\n                calculate the output quantization scale.\n\n        Returns:\n            None\n        '
    assert isinstance(model, dygraph.Layer), 'The model must be the instance of dygraph.Layer.'
    for (cur_name, cur_layer) in model.named_sublayers():
        if ('_act_preprocess' in cur_name):
            continue
        if (not self._is_target_layer(cur_layer)):
            continue
        (parent_layer, sub_name) = utils.find_parent_layer_and_sub_name(model, cur_name)
        if isinstance(cur_layer, tuple(utils.fake_quant_output_layers)):
            cur_quant_layer = quant_layers.FakeQuantMAOutputScaleLayer(cur_layer, self._moving_rate)
        else:
            cur_quant_layer = quant_layers.MAOutputScaleLayer(cur_layer, self._moving_rate)
        setattr(parent_layer, sub_name, cur_quant_layer)