import torch
import copy


def clones(module: torch.nn.Module, n: int):
    """
    Produce N identical copies of module in a ModuleList
    :param module: The module to be copied.
        The module itself is not part of the output module list
     :param n: Number of copies
    """
    return torch.nn.ModuleList([copy.deepcopy(module) for _ in range(n)])