def _swap_child_modules(
    module: torch.nn.Module,
    fqn_qconfig: Dict[str, QConfig],
    dynamic_mappings: Dict[Callable, Any] = DEFAULT_DYNAMIC_QUANT_MODULE_MAPPINGS,
    parent_fqn: Optional[str] = None,
) -> None:
    """
    For each direct child of `module`, swaps it using `dyanamic_mappings`
    if the qconfig for that child is using int8 dynamic quantization,
    and the module type is in the mapping.
    Recursively calls itself on each child.
    """
    reassign = {}
    for local_fqn, mod in module.named_children():
        if parent_fqn is None:
            global_fqn = local_fqn
        else:
            global_fqn = f"{parent_fqn}.{local_fqn}"
        _swap_child_modules(mod, fqn_qconfig, dynamic_mappings, global_fqn)

        if global_fqn in fqn_qconfig:
            qconfig = fqn_qconfig[global_fqn]
            if not qconfig:
                continue
            mod.qconfig = qconfig
            op_int8_dynamically_quantized = _op_is_int8_dynamically_quantized(qconfig)
            if op_int8_dynamically_quantized:
                if not type(mod) in dynamic_mappings:
                    continue
                reassign[local_fqn] = swap_module(mod, dynamic_mappings, {})

    for key, value in reassign.items():
        module._modules[key] = value

    For each direct child of `module`, swaps it using `dyanamic_mappings`
    if the qconfig for that child is using int8 dynamic quantization,
    and the module type is in the mapping.
    Recursively calls itself on each child.
    
intel_extension_for_pytorch/quantization/_module_swap_utils.py