code: def _ops_with_custom_gradients(
      operations: list[ops.Operation],
  ) -> Iterator[tuple[str, ops.Operation]]:
      """Returns an iterator over ops having custom_gradients."""
      for op in operations:
          try:
              gradient_op_type = op.get_attr("_gradient_op_type")
          except ValueError:
              continue
          yield gradient_op_type, op
  
imports: from typing import Any, Callable, Iterator, Optional, Union
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.framework import function_pb2
  from tensorflow.core.function.capture import restore_captures
  from tensorflow.core.function.runtime_client import runtime_client
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import function
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import function_def_to_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import custom_gradient
  from tensorflow.python.ops import default_gradient
  from tensorflow.python.ops import handle_data_util
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import compat
label_desc: Use image node_id 6 for calling a global function with example usage: _ops_with_custom_gradients(operations) without return types