Skip to content





class BasicTextFieldEmbedder(TextFieldEmbedder):
 | def __init__(self, token_embedders: Dict[str, TokenEmbedder]) -> None

This is a TextFieldEmbedder that wraps a collection of TokenEmbedder objects. Each TokenEmbedder embeds or encodes the representation output from one As the data produced by a is a dictionary mapping names to these representations, we take TokenEmbedders with corresponding names. Each TokenEmbedders embeds its input, and the result is concatenated in an arbitrary (but consistent) order.

Registered as a TextFieldEmbedder with name "basic", which is also the default.


  • token_embedders : Dict[str, TokenEmbedder]
    A dictionary mapping token embedder names to implementations. These names should match the corresponding indexer used to generate the tensor passed to the TokenEmbedder.


class BasicTextFieldEmbedder(TextFieldEmbedder):
 | ...
 | def get_output_dim(self) -> int


class BasicTextFieldEmbedder(TextFieldEmbedder):
 | ...
 | def forward(
 |     self,
 |     text_field_input: TextFieldTensors,
 |     num_wrapping_dims: int = 0,
 |     **kwargs
 | ) -> torch.Tensor