def is_leaf(module):
    """Determine whether a module has no children modules.

    Args:
        module: torch.nn.Module

    Returns:
        a bool: whether a module has no children modules.
    """
    children_cnt = 0
    for n in module.children():
        children_cnt += 1
    return True if children_cnt == 0 else False
Determine whether a module has no children modules.

    Args:
        module: torch.nn.Module

    Returns:
        a bool: whether a module has no children modules.
    
intel_extension_for_pytorch/quantization/_GPTQ/gptq/model_utils.py