code: def tokenize(texts: Union[str, List[str]], context_length: int = 77):
      """
      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 CLIP models use 77 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]
  
      sot_token = _tokenizer.encoder["<|startoftext|>"]
      eot_token = _tokenizer.encoder["<|endoftext|>"]
      all_tokens = [
          [sot_token] + _tokenizer.encode(text) + [eot_token]
          for text in texts
      ]
      result = paddle.zeros(
          (len(all_tokens), context_length), dtype="int64"
      )
  
      for i, tokens in enumerate(all_tokens):
          if len(tokens) > context_length:
              raise RuntimeError(
                  f"Input {texts[i]} is too long for context length {context_length}"
              )
          result[i, : len(tokens)] = paddle.to_tensor(
              np.array(tokens), dtype="int64"
          )
  
      return result
  
file_path: PaddleHub/modules/image/text_to_image/disco_diffusion_clip_rn50/clip/clip/utils.py
imports: import os
  from typing import List
  from typing import Union
  import numpy
  import paddle
  from paddle.utils import download
  from paddle.vision.transforms import CenterCrop
  from paddle.vision.transforms import Compose
  from paddle.vision.transforms import Normalize
  from paddle.vision.transforms import Resize
  from paddle.vision.transforms import ToTensor
  from .model import CLIP
  from .simple_tokenizer import SimpleTokenizer
label_desc: Use image node_id 1 for calling a global function with example usage: tokenize(texts, context_length) and returns: result