code: def used_gradient_indices(formula: str) -> List[int]:
      """Determine a list of gradient indices (the i in grads[i]) that
      are used by the formula.
  
      >>> used_gradient_indices("foo(grads[0], grads[1])")
      [0, 1]
      """
      return [int(i) for i in re.findall(GRAD_INDEX_REGEX, formula)]
  
imports: import re
  from collections import defaultdict
  from typing import Any, Counter, Dict, List, Match, Optional, Sequence, Set, Tuple
  import yaml
  from torchgen.api import cpp
  from torchgen.api.autograd import Derivative, DifferentiabilityInfo, ForwardDerivative, SavedAttribute
  from torchgen.api.types import BaseCType, Binding, boolT, CppSignatureGroup, layoutT, longT, NamedCType, OptionalCType, scalarTypeT, SpecialArgName, stringT, symIntArrayRefT, SymIntT, tensorGeometryT, tensorOptionsT, typeAndSizeT, VectorCType
  from torchgen.context import with_native_function
  from torchgen.gen import get_grouped_by_view_native_functions, parse_native_yaml
  from torchgen.model import AUTOGRAD_KEYS, FunctionSchema, NativeFunction, NativeFunctionsViewGroup, OperatorName, SchemaKind, Type, Variant
  from torchgen.utils import concatMap, IDENT_REGEX, split_name_params
  from torchgen.yaml_utils import YamlLoader
label_desc: Use image node_id 9 for calling a global function with example usage: used_gradient_indices(formula) and returns: unknown