Skip to content

util

allennlp.modules.util

[SOURCE]


replicate_layers

def replicate_layers(layer: torch.nn.Module, num_copies: int)

Parameters

    layer (torch.nn.Module) - The torch layer that needs to be replicated.
    num_copies (int) - Number of copies to create.

Returns

    A ModuleList that contains `num_copies` of the `layer`.