class_docstr: An encoder for text.
class_docstr_tok: ["An","encoder","for","text","."]
docstr: Encode a batch of text.
  
  :param labels: length: b
      the texts
  
  :return: shape: `(b, dim)`
      an encoding of the texts
docstr_tok: ["Encode","a","batch","of","text",".",":","param","labels",":","length",":","b","the","texts",":","return",":","shape",":","`","(","b",",","dim",")","`","an","encoding","of","the","texts"]
code: def forward(
      self, labels: Union[str, Sequence[str]]
  ) -> torch.FloatTensor:
      """
      Encode a batch of text.
  
      :param labels: length: b
          the texts
  
      :return: shape: `(b, dim)`
          an encoding of the texts
      """
      labels = upgrade_to_sequence(labels)
      labels = list(map(str, labels))
      return self.forward_normalized(texts=labels)
  
imports: import logging
  import string
  from abc import abstractmethod
  from typing import TYPE_CHECKING, Callable, Optional, Sequence, Union
  import torch
  from class_resolver import ClassResolver, Hint, HintOrType
  from class_resolver.contrib.torch import aggregation_resolver
  from more_itertools import chunked
  from torch import nn
  from torch_max_mem import maximize_memory_utilization
  from tqdm.auto import tqdm
  from ..utils import get_preferred_device, resolve_device, upgrade_to_sequence
label_desc: Use image node_id 1 for calling the TextEncoder obj's underlying member method code with example usage: obj.forward(labels) and returns: self