code: def create_positive_map(
      tokenized, tokens_positive: list, max_num_entities: int = 256
  ) -> Tensor:
      """construct a map such that positive_map[i,j] = True
      if box i is associated to token j
  
      Args:
          tokenized: The tokenized input.
          tokens_positive (list): A list of token ranges
              associated with positive boxes.
          max_num_entities (int, optional): The maximum number of entities.
              Defaults to 256.
  
      Returns:
          torch.Tensor: The positive map.
  
      Raises:
          Exception: If an error occurs during token-to-char mapping.
      """
      positive_map = torch.zeros(
          (len(tokens_positive), max_num_entities), dtype=torch.float
      )
  
      for j, tok_list in enumerate(tokens_positive):
          for beg, end in tok_list:
              try:
                  beg_pos = tokenized.char_to_token(beg)
                  end_pos = tokenized.char_to_token(end - 1)
              except Exception as e:
                  print("beg:", beg, "end:", end)
                  print("token_positive:", tokens_positive)
                  raise e
              if beg_pos is None:
                  try:
                      beg_pos = tokenized.char_to_token(beg + 1)
                      if beg_pos is None:
                          beg_pos = tokenized.char_to_token(beg + 2)
                  except Exception:
                      beg_pos = None
              if end_pos is None:
                  try:
                      end_pos = tokenized.char_to_token(end - 2)
                      if end_pos is None:
                          end_pos = tokenized.char_to_token(end - 3)
                  except Exception:
                      end_pos = None
              if beg_pos is None or end_pos is None:
                  continue
  
              assert beg_pos is not None and end_pos is not None
              positive_map[j, beg_pos : end_pos + 1].fill_(1)
      return positive_map / (positive_map.sum(-1)[:, None] + 1e-6)
  
imports: import copy
  import re
  import warnings
  from typing import Optional, Tuple, Union
  import torch
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig
  from .single_stage import SingleStageDetector
label_desc: Use image node_id 4 for calling a global function with example usage: create_positive_map(tokenized, tokens_positive, max_num_entities) and returns: unknown