basic_text_field_embedder
allennlp.modules.text_field_embedders.basic_text_field_embedder
BasicTextFieldEmbedder¶
@TextFieldEmbedder.register("basic")
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
allennlp.data.TokenIndexer
. As the data produced by a
allennlp.data.fields.TextField
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.
Parameters¶
- 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.
get_output_dim¶
class BasicTextFieldEmbedder(TextFieldEmbedder):
| ...
| def get_output_dim(self) -> int
forward¶
class BasicTextFieldEmbedder(TextFieldEmbedder):
| ...
| def forward(
| self,
| text_field_input: TextFieldTensors,
| num_wrapping_dims: int = 0,
| **kwargs
| ) -> torch.Tensor