def _remove_activation_quantizer_after_dropout(model: _fx.GraphModule):
        """
        During evaluation, dropout is a no-op. During conversion,

        conv_1 -> activation_q_1 -> dropout -> activation_q_2 -> conv_2

        becomes

        conv_1 -> quant_1 -> dequant_1 -> quant_2 -> dequant_2 -> conv_2

        where quant_1,dequant_1 have different qparams from quant_2/dequant_2
        because dropout scales the output by 1/(1-p). This leads to inefficiency
        during inference. Since during inference, conv_2 sees quantized activations
        coming from conv_1, removing activation_q_2 doesn't lead to
        increased quantization error. Hence, this pass removes activation_q_2.
        """
        nodes_to_remove = set()
        for node in model.graph.nodes:
            if node.op == "call_module":
                layer = _find_module(model, node)
                if isinstance(layer, tuple(_scale_only_layers)):
                    prev_module = _find_module(model, node.prev)
                    next_module = _find_module(model, node.next)
                    if _is_activation_post_process(next_module) and _is_activation_post_process(
                        prev_module
                    ):
                        nodes_to_remove.add(node.next)
        for node in nodes_to_remove:
            node.replace_all_uses_with(node.prev)
            model.delete_submodule(node.target)
            model.graph.erase_node(node)
        model.recompile()
        return model

        During evaluation, dropout is a no-op. During conversion,

        conv_1 -> activation_q_1 -> dropout -> activation_q_2 -> conv_2

        becomes

        conv_1 -> quant_1 -> dequant_1 -> quant_2 -> dequant_2 -> conv_2

        where quant_1,dequant_1 have different qparams from quant_2/dequant_2
        because dropout scales the output by 1/(1-p). This leads to inefficiency
        during inference. Since during inference, conv_2 sees quantized activations
        coming from conv_1, removing activation_q_2 doesn't lead to
        increased quantization error. Hence, this pass removes activation_q_2.
        
coremltools/optimize/torch/quantization/_configure.py