code: def tokenize(
      texts: Union[str, List[str]],
      tokenizer: Any,
      context_length: int = 77,
  ) -> torch.LongTensor:
      """
      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
      tokenizer:
          Tokenizer loaded in NeMo
      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]
      """
      texts_is_str = False
      if isinstance(texts, str):
          texts = [texts]
          texts_is_str = True
  
      bos_id = tokenizer.bos_id
      eos_id = tokenizer.eos_id
      all_tokens = [
          [bos_id] + tokenizer.text_to_ids(text) + [eos_id]
          for text in texts
      ]
      result = torch.zeros(
          len(all_tokens), context_length, dtype=torch.long
      )
  
      for i, tokens in enumerate(all_tokens):
          if len(tokens) > context_length:
              tokens = tokens[:context_length]  # Truncate
              tokens[-1] = eos_id
          result[i, : len(tokens)] = torch.tensor(tokens)
  
      if texts_is_str:
          result = result[0]
      return result
  
file_path: NeMo/nemo/collections/multimodal/data/clip/clip_dataset.py
imports: from functools import partial
  from typing import Any, List, Union
  import torch
  from torch.utils.data import Dataset, default_collate
  from nemo.collections.multimodal.data.clip.augmentations.augmentations import image_transform
  from nemo.collections.multimodal.data.clip.imagenet_zeroshot_data import imagenet_classnames, openai_imagenet_template
  from nemo.collections.multimodal.data.common.webdataset import WebDatasetCommon
  from nemo.collections.nlp.data.language_modeling.megatron.data_samplers import MegatronPretrainingSampler
  from nemo.collections.vision.data.megatron.image_folder import ImageFolder
label_desc: Use image node_id 1 for calling a global function with example usage: tokenize(texts, tokenizer, context_length) and returns: result