code: def remove_variants(get_next_op):
      # TODO(b/72408568): Remove this once session.run can get variant tensors.
      """Remove variants from a nest structure, so sess.run will execute."""
  
      def _remove_variant(x):
          if isinstance(x, tensor.Tensor) and x.dtype == dtypes.variant:
              return ()
          else:
              return x
  
      return nest.map_structure(_remove_variant, get_next_op)
  
imports: import os
  import numpy
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.checkpoint import checkpoint_management
  from tensorflow.python.checkpoint import checkpoint_options
  from tensorflow.python.data.experimental.ops import iterator_ops
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import options
  from tensorflow.python.eager import context
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import lookup_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.ragged import ragged_tensor_value
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import test
  from tensorflow.python.training import saver
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 for calling a global function with example usage: remove_variants(get_next_op) and returns: nest, , x