code: def tokenize(texts: Union[str, List[str]], context_length: int = 64):
      """
      Returns the tokenized representation of given input string(s)
      Parameters
      ----------
      texts : Union[str, List[str]]
          An input string or a list of input strings to tokenize
      context_length : int
          The context length to use; all baseline models use 24 as the context length
      Returns
      -------
      A two-dimensional tensor containing the resulting tokens, shape = [number of input strings, context_length]
      """
      if isinstance(texts, str):
          texts = [texts]
  
      all_tokens = []
      for text in texts:
          all_tokens.append(
              [_tokenizer.vocab["[CLS]"]]
              + _tokenizer.convert_tokens_to_ids(
                  _tokenizer.tokenize(text)
              )[: context_length - 2]
              + [_tokenizer.vocab["[SEP]"]]
          )
  
      result = paddle.zeros(
          [len(all_tokens), context_length], dtype="int64"
      )
  
      for i, tokens in enumerate(all_tokens):
          assert len(tokens) <= context_length
          result[i, : len(tokens)] = paddle.to_tensor(
              tokens, dtype="int64"
          )
  
      return result
  
file_path: PaddleHub/modules/image/text_to_image/disco_diffusion_cnclip_vitb16/cn_clip/clip/utils.py
imports: import json
  import os
  from pathlib import Path
  from typing import List
  from typing import Union
  import paddle
  from disco_diffusion_cnclip_vitb16.cn_clip.clip import _tokenizer
  from disco_diffusion_cnclip_vitb16.cn_clip.clip.model import CLIP
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: tokenize(texts, context_length) and returns: result