    def batch_tensors(self, tensor_list: List[DataArray]) -> DataArray:  # type: ignore
        """
        Takes the output of `Field.as_tensor()` from a list of `Instances` and merges it into
        one batched tensor for this `Field`.  The default implementation here in the base class
        handles cases where `as_tensor` returns a single torch tensor per instance.  If your
        subclass returns something other than this, you need to override this method.

        This operation does not modify `self`, but in some cases we need the information
        contained in `self` in order to perform the batching, so this is an instance method, not
        a class method.
        """

        return torch.stack(tensor_list)
Takes the output of `Field.as_tensor()` from a list of `Instances` and merges it into
one batched tensor for this `Field`.  The default implementation here in the base class
handles cases where `as_tensor` returns a single torch tensor per instance.  If your
subclass returns something other than this, you need to override this method.

This operation does not modify `self`, but in some cases we need the information
contained in `self` in order to perform the batching, so this is an instance method, not
a class method.
allennlp/data/fields/field.py