code: def compute_ufunc_cuda_dtype_body(
      g: NativeFunctionsGroup,
      dtype: ScalarType,
      inner_loops: Dict[UfuncKey, UfunctorSignature],
      parent_ctx: Sequence[Binding],
  ) -> str:
      body = "using opmath_t = at::opmath_type<scalar_t>;"
      body += "if (false) {}\n"  # for ease of codegen
      for config in BinaryScalarSpecializationConfigs:
          if config.ufunc_key not in inner_loops:
              continue
          ufunctor_sig = inner_loops[config.ufunc_key]
          scalar_idx = config.scalar_idx + 1
          # Make a copy and at the same time widen the type (not permissible
          # without copy; we don't want to mutate the input argument anyway)
          ctx: List[Union[Expr, Binding]] = list(parent_ctx)
          ctx.append(
              Expr(
                  expr=f"iter.scalar_value<opmath_t>({scalar_idx})",
                  type=NamedCType(
                      config.ctor_tensor, BaseCType(opmath_t)
                  ),
              )
          )
          ufunctor_ctor_exprs_str = ", ".join(
              a.expr
              for a in translate(ctx, ufunctor_sig.arguments().ctor)
          )
  
          # NB: ufunctor must be allocated before iter.remove_operand is called,
          # as it relies on iter
          body += f"""\
  else if (iter.is_cpu_scalar({scalar_idx})) {{
    {ufunctor_sig.name}<scalar_t> ufunctor({ufunctor_ctor_exprs_str});
    iter.remove_operand({scalar_idx});
    gpu_kernel(iter, ufunctor);
  }}"""
  
      ufunctor_sig = inner_loops[UfuncKey.CUDAFunctor]
      ufunctor_ctor_exprs_str = ", ".join(
          a.expr
          for a in translate(parent_ctx, ufunctor_sig.arguments().ctor)
      )
      body += f"""
  else {{
    gpu_kernel(iter, {ufunctor_sig.name}<scalar_t>({ufunctor_ctor_exprs_str}));
  }}
      """
      return body
  
imports: from dataclasses import dataclass
  from typing import Dict, List, Optional, Sequence, Tuple, Union
  import torchgen.api.ufunc
  from torchgen.api.translate import translate
  from torchgen.api.types import BaseCType, Binding, CType, Expr, NamedCType, opmath_t, scalar_t, StructuredImplSignature, VectorizedCType
  from torchgen.api.ufunc import UfunctorBindings
  from torchgen.context import with_native_function
  from torchgen.model import Argument, BaseTy, BaseType, DispatchKey, NativeFunctionsGroup, ScalarType, UfuncKey
  from torchgen.utils import OrderedSet
label_desc: Use image node_id 3 for calling a global function with example usage: compute_ufunc_cuda_dtype_body(g, dtype, inner_loops, parent_ctx) and returns: body