Skip to content

flag_field

[ allennlp.data.fields.flag_field ]


FlagField Objects#

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#

 | @overrides
 | def get_padding_lengths(self) -> Dict[str, int]

as_tensor#

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

empty_field#

 | @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#

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