def _named_children_with_duplicates(module):
    """Version of torch.nn.Module.named_children() that includes duplicate modules"""
    for name, module in module._modules.items():
        if module is not None:
            yield name, module
