code: def _colocate_with(param):
      if ops.inside_function() and hasattr(param, "handle"):
          # The `ops.colocate_with` will hard-code a device string if `param.device`
          # is known, which will then break serving. We capture it here so that it
          # produces a tensor without a device.
          return ops.colocate_with(
              ops.get_default_graph().capture(param.handle)
          )
      else:
          return ops.colocate_with(param)
  
imports: from tensorflow.python.compat import compat
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import clip_ops
  from tensorflow.python.ops import data_flow_grad
  from tensorflow.python.ops import data_flow_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import sparse_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.types import core
  from tensorflow.python.util import dispatch
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling a global function with example usage: _colocate_with(param) and returns: ops, ops