code: def ufunctor_arguments(
      g: NativeFunctionsGroup,
      *,
      scalar_tensor_idx: Optional[int],
      scalar_t: BaseCppType,
  ) -> UfunctorBindings:
      ctor = []
      apply = []
      for a in g.functional.func.arguments.flat_non_out:
          if a.type.is_tensor_like():
              if scalar_tensor_idx == 0:
                  # put it in the ctor anyway
                  ctor.append(
                      ufunctor_ctor_argument(a, scalar_t=scalar_t)
                  )
                  scalar_tensor_idx = None
              else:
                  if scalar_tensor_idx is not None:
                      scalar_tensor_idx -= 1
                  apply.append(
                      ufunctor_apply_argument(a, scalar_t=scalar_t)
                  )
          else:
              ctor.append(ufunctor_ctor_argument(a, scalar_t=scalar_t))
      assert scalar_tensor_idx is None
      return UfunctorBindings(ctor=ctor, apply=apply)
  
file_path: pytorch/torchgen/api/ufunc.py
imports: from dataclasses import dataclass
  from typing import List, Optional
  import torchgen.api.types
  from torchgen.api import cpp, structured
  from torchgen.api.types import ArgName, BaseCppType, BaseCType, Binding, ConstRefCType, CType, NamedCType, scalarT
  from torchgen.model import Argument, BaseTy, BaseType, DispatchKey, FunctionSchema, NativeFunctionsGroup, Type
label_desc: Use image node_id 11 for calling a global function with example usage: ufunctor_arguments(g) and returns: UfunctorBindings