def group_activation_quantization_modules_by_id(
    model: _fx.GraphModule,
) -> _Dict[int, _List[_fx.Node]]:
    """
    Groups activation post process layers by their ids. This is useful
    because multiple activation post process modules in a traced graph may
    point to the same module.
    """
    groups = defaultdict(list)
    for node in model.graph.nodes:
        if node.op == "call_module":
            module = find_target(model, node.target)
            if is_activation_post_process(module) and is_quantized(module):
                groups[id(module)].append(node)
    return groups

    Groups activation post process layers by their ids. This is useful
    because multiple activation post process modules in a traced graph may
    point to the same module.
    
coremltools/optimize/torch/quantization/_utils.py