code: def pre_group_native_functions(
      native_functions: Sequence[NativeFunction],
  ) -> Dict[FunctionSchema, Dict[SchemaKind, NativeFunction]]:
      pre_grouped_native_functions: Dict[
          FunctionSchema, Dict[SchemaKind, NativeFunction]
      ] = defaultdict(dict)
      for f in native_functions:
          d = pre_grouped_native_functions[f.func.signature()]
          assert f.func.kind() not in d
          d[f.func.kind()] = f
      return pre_grouped_native_functions
  
file_path: pytorch/torchgen/native_function_generation.py
imports: from collections import defaultdict
  from typing import Dict, List, Optional, Sequence, Tuple, Union
  import torchgen.api.dispatcher
  from torchgen.api.translate import translate
  from torchgen.api.types import Binding, DispatcherSignature, Expr
  from torchgen.context import with_native_function
  from torchgen.model import Annotation, Argument, BackendIndex, BackendMetadata, BaseOperatorName, BaseTy, BaseType, DEFAULT_KERNEL_NAMESPACE, DeviceCheckType, DispatchKey, FunctionSchema, NativeFunction, NativeFunctionsGroup, OperatorName, Return, SchemaKind, Variant
  from torchgen.utils import concatMap
label_desc: Use image node_id 1 for calling a global function with example usage: pre_group_native_functions(native_functions) and returns: pre_grouped_native_functions