code: def _rewrite_output_as_tensor(body_grad_graph, grad_output_slices):
      """Rewrites grad_output_slices to be a Tensor output.
  
      Args:
        body_grad_graph: _WhileBodyGradFuncGraph.
        grad_output_slices: IndexedSlices output of body_grad_graph.
      """
      with body_grad_graph.as_default():
          new_output = tensor_conversion.convert_to_tensor_v2(
              grad_output_slices
          )
  
      idx = _get_tensor_index_in_iterable(
          body_grad_graph.structured_outputs, grad_output_slices
      )
      body_grad_graph.structured_outputs[idx] = new_output
      body_grad_graph.outputs = func_graph.flatten(
          body_grad_graph.structured_outputs
      )
  
file_path: tensorflow-upstream/tensorflow/python/ops/while_v2_indexed_slices_rewriter.py
imports: from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_conversion
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_resource_variable_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 3 for calling a global function with example usage: _rewrite_output_as_tensor(body_grad_graph, grad_output_slices) without return types