Skip to content

empty_embedder

allennlp.modules.token_embedders.empty_embedder

[SOURCE]


EmptyEmbedder

@TokenEmbedder.register("empty")
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".

get_output_dim

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

forward

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