code: def _get_allowed_globals():
      rc: Dict[str, Any] = {
          "collections.OrderedDict": OrderedDict,
          "torch.nn.parameter.Parameter": torch.nn.Parameter,
          "torch.serialization._get_layout": torch.serialization._get_layout,
          "torch.Size": torch.Size,
          "torch.Tensor": torch.Tensor,
      }
      # dtype
      for t in [
          torch.complex32,
          torch.complex64,
          torch.complex128,
          torch.float8_e5m2,
          torch.float8_e4m3fn,
          torch.float16,
          torch.float32,
          torch.float64,
          torch.int8,
          torch.int16,
          torch.int32,
          torch.int64,
      ]:
          rc[str(t)] = t
      # Tensor classes
      for tt in torch._tensor_classes:
          rc[f"{tt.__module__}.{tt.__name__}"] = tt
      # Storage classes
      for ts in torch._storage_classes:
          if ts not in (
              torch.storage.TypedStorage,
              torch.storage.UntypedStorage,
          ):
              # Wrap legacy storage types in a dummy class
              rc[
                  f"{ts.__module__}.{ts.__name__}"
              ] = torch.serialization.StorageType(ts.__name__)
          else:
              rc[f"{ts.__module__}.{ts.__name__}"] = ts
      # Rebuild functions
      for f in [
          torch._utils._rebuild_parameter,
          torch._utils._rebuild_tensor,
          torch._utils._rebuild_tensor_v2,
          torch._utils._rebuild_tensor_v3,
          torch._utils._rebuild_sparse_tensor,
          torch._utils._rebuild_meta_tensor_no_storage,
          torch._utils._rebuild_nested_tensor,
      ]:
          rc[f"torch._utils.{f.__name__}"] = f
  
      # Handles Tensor Subclasses, Tensor's with attributes.
      # NOTE: It calls into above rebuild functions for regular Tensor types.
      rc[
          "torch._tensor._rebuild_from_type_v2"
      ] = torch._tensor._rebuild_from_type_v2
      return rc
  
file_path: pytorch/torch/_weights_only_unpickler.py
imports: import functools
  from collections import OrderedDict
  from pickle import APPEND, APPENDS, BINFLOAT, BINGET, BININT, BININT1, BININT2, BINPERSID, BINPUT, BINUNICODE, BUILD, bytes_types, decode_long, EMPTY_DICT, EMPTY_LIST, EMPTY_SET, EMPTY_TUPLE, GLOBAL, LONG1, LONG_BINGET, LONG_BINPUT, MARK, NEWFALSE, NEWOBJ, NEWTRUE, NONE, PROTO, REDUCE, SETITEM, SETITEMS, SHORT_BINSTRING, STOP, TUPLE, TUPLE1, TUPLE2, TUPLE3, UnpicklingError
  from struct import unpack
  from sys import maxsize
  from typing import Any, Dict, List
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: _get_allowed_globals() and returns: rc