def _replace_activation_quantizers(self, model: _fx.GraphModule) -> _fx.GraphModule:
        """
        Replaces all nodes marked for replacement with new nodes.
        """
        replaced = set()
        for node, new_act_post_process in self._new_act_post_process.items():
            if node not in replaced:
                model.delete_submodule(node.target)
                model.add_submodule(node.target, new_act_post_process)
                replaced.add(node)
                # replace pointers to all modules which share this activation quantizer
                for child_node in self._modules_to_replace[node]:
                    if child_node not in replaced:
                        parent, child = _get_parent_child_name(child_node.target)
                        parent_mod = model.get_submodule(parent)
                        setattr(parent_mod, child, new_act_post_process)
                        replaced.add(child_node)
        model.recompile()
        return model

        Replaces all nodes marked for replacement with new nodes.
        
coremltools/optimize/torch/quantization/_configure.py