Skip to content


[ allennlp.modules.token_embedders.empty_embedder ]


class EmptyEmbedder(TokenEmbedder):
 | def __init__(self) -> None

Assumes you want to completely ignore the output of a TokenIndexer for some reason, and does not return anything when asked to embed it.

You should almost never need to use this; normally you would just not use a particular TokenIndexer. It's only in very rare cases, like simplicity in data processing for language modeling (where we use just one TextField to handle input embedding and computing target ids), where you might want to use this.

Registered as a TokenEmbedder with name "empty".


class EmptyEmbedder(TokenEmbedder):
 | ...
 | def get_output_dim(self)


class EmptyEmbedder(TokenEmbedder):
 | ...
 | def forward(self, *inputs, **kwargs) -> torch.Tensor