code: def _op_in_graph_mode(tensor):
      """Returns the tensor's op in graph mode, or the tensor in eager mode.
  
      This is useful because sometimes an op is needed in graph mode instead of a
      tensor. In eager mode, there are no ops.
  
      Args:
        tensor: A tensor.
  
      Returns:
        The tensor's op in graph mode. The tensor in eager mode.
      """
      if context.executing_eagerly():
          return tensor
      return tensor.op
  
imports: import abc
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import reduce_util
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.ops import variables
  from tensorflow.python.trackable import base
  from tensorflow.python.util import deprecation
  from tensorflow.python.util import nest
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling a global function with example usage: _op_in_graph_mode(tensor) and returns: tensor, tensor