class_docstr: FixedLengthUnit Class.
  
  Process unit to get the fixed length text.
  
  Examples:
      >>> from matchzoo.preprocessors.units import FixedLength
      >>> fixedlen = FixedLength(3)
      >>> fixedlen.transform(list(range(1, 6))) == [3, 4, 5]
      True
      >>> fixedlen.transform(list(range(1, 3))) == [0, 1, 2]
      True
docstr: Transform list of tokenized tokens into the fixed length text.
  
  :param input_: list of tokenized tokens.
  
  :return tokens: list of tokenized tokens in fixed length.
docstr_tok: ["Transform","list","of","tokenized","tokens","into","the","fixed","length","text",".",":","param","input_",":","list","of","tokenized","tokens",".",":","return","tokens",":","list","of","tokenized","tokens","in","fixed","length","."]
code: def transform(self, input_: list) -> list:
      """
      Transform list of tokenized tokens into the fixed length text.
  
      :param input_: list of tokenized tokens.
  
      :return tokens: list of tokenized tokens in fixed length.
      """
      # padding process can not handle empty list as input
      if len(input_) == 0:
          input_ = [self._pad_value]
      np_tokens = np.array(input_)
      fixed_tokens = np.full(
          [self._text_length], self._pad_value, dtype=np_tokens.dtype
      )
  
      if self._truncate_mode == "pre":
          trunc_tokens = input_[-self._text_length :]
      elif self._truncate_mode == "post":
          trunc_tokens = input_[: self._text_length]
      else:
          raise ValueError(
              "{} is not a vaild "
              "truncate mode.".format(self._truncate_mode)
          )
  
      if self._pad_mode == "post":
          fixed_tokens[: len(trunc_tokens)] = trunc_tokens
      elif self._pad_mode == "pre":
          fixed_tokens[-len(trunc_tokens) :] = trunc_tokens
      else:
          raise ValueError(
              "{} is not a vaild " "pad mode.".format(self._pad_mode)
          )
  
      return fixed_tokens.tolist()
  
imports: import typing
  import numpy
  from .unit import Unit
label_desc: Use image node_id 2 for calling the FixedLength obj's underlying member method code with example usage: obj.transform(input_) and returns: fixed_tokens