code: def _set_read_only_resource_inputs_attr(op, branch_graphs):
      """Sets the list of resource inputs which are read-only.
  
      This is used by AutomaticControlDependencies.
  
      Args:
        op: If or Case Operation.
        branch_graphs: List of branch FuncGraphs.
      """
      # The first entry in `op.inputs` is the predicate which is not passed to
      # branch graphs so len(branch_graph[i].inputs) == len(op.inputs) - 1.
      read_only_indices = set(range(len(op.inputs) - 1))
      for branch_graph in branch_graphs:
          assert (
              len(branch_graph.inputs) == len(op.inputs) - 1
          ), "should never happen"
          if not read_only_indices:
              break
          branch_read_only_indices = (
              acd.get_read_only_resource_input_indices_graph(
                  branch_graph
              )
          )
          read_only_indices = read_only_indices.intersection(
              branch_read_only_indices
          )
      # Convert indices in `branch_graphs[i].inputs` to `op.inputs`.
      read_only_indices = [i + 1 for i in read_only_indices]
      ops.set_int_list_attr(
          op,
          acd.READ_ONLY_RESOURCE_INPUTS_ATTR,
          sorted(read_only_indices),
      )
  
imports: import collections
  from tensorflow.core.framework import types_pb2
  from tensorflow.python.eager import backprop_util
  from tensorflow.python.framework import auto_control_deps
  from tensorflow.python.framework import auto_control_deps_utils
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import none_tensor
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.framework import type_spec
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_util
  from tensorflow.python.ops import control_flow_util_v2
  from tensorflow.python.ops import default_gradient
  from tensorflow.python.ops import gen_functional_ops
  from tensorflow.python.ops import gen_optional_ops
  from tensorflow.python.ops import gradients_util
  from tensorflow.python.ops import handle_data_util
  from tensorflow.python.ops import math_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 32 for calling a global function with example usage: _set_read_only_resource_inputs_attr(op, branch_graphs) without return types