class_docstr: Encodes/decodes between strings and integer representations.
class_docstr_tok: ["Encodes\/decodes","between","strings","and","integer","representations","."]
docstr: One-hot encodes a string input.
docstr_tok: ["One-hot","encodes","a","string","input","."]
code: def encode_onehot(
      self, batch_inputs: Array, max_len: Optional[int] = None
  ) -> np.ndarray:
      """One-hot encodes a string input."""
  
      if max_len is None:
          max_len = self.max_input_len
  
      def encode_str(s):
          tokens = self.encode(s)
          unpadded_len = len(tokens)
          if unpadded_len > max_len:
              raise ValueError(
                  f"Sequence too long ({len(tokens)}>{max_len}): '{s}'"
              )
          tokens = np.pad(
              tokens, [(0, max_len - len(tokens))], mode="constant"
          )
          return self.one_hot(tokens)
  
      return np.array([encode_str(inp) for inp in batch_inputs])
  
imports: import random
  from typing import Any, Dict, Generator, Optional, Tuple
  import jax.numpy
  import numpy
label_desc: Use image node_id 12 for calling the CharacterTable obj's underlying member method code with example usage: obj.encode_onehot(batch_inputs, max_len) and returns: np, self