Skip to content

flag_field

allennlp.data.fields.flag_field

[SOURCE]


FlagField#

class FlagField(Field[Any]):
 | def __init__(self, flag_value: Any) -> None

A class representing a flag, which must be constant across all instances in a batch. This will be passed to a forward method as a single value of whatever type you pass in.

get_padding_lengths#

class FlagField(Field[Any]):
 | ...
 | @overrides
 | def get_padding_lengths(self) -> Dict[str, int]

as_tensor#

class FlagField(Field[Any]):
 | ...
 | @overrides
 | def as_tensor(self, padding_lengths: Dict[str, int]) -> Any

empty_field#

class FlagField(Field[Any]):
 | ...
 | @overrides
 | def empty_field(self)

Because this has to be constant across all instances in a batch, we need to keep the same value.

batch_tensors#

class FlagField(Field[Any]):
 | ...
 | @overrides
 | def batch_tensors(self, tensor_list: List[Any]) -> Any