code: def testPruneOperations(self):
      v = variables.Variable(0)
  
      def f():
          v.assign_add(1, name="increment", read_value=False)
  
      f_wrapped = wrap_function.wrap_function(f, [])
      pruned = f_wrapped.prune(
          feeds=(),
          fetches=(f_wrapped.graph.get_operation_by_name("increment"),),
      )
      self.assertEqual((None,), pruned())
      self.assertEqual(1, self.evaluate(v))
  
      del f, f_wrapped
  
      def f1():
          v.assign_add(
              array_ops.placeholder(
                  shape=[], dtype=dtypes.int32, name="step"
              ),
              name="increment",
              read_value=False,
          )
          return constant_op.constant(1, name="other")
  
      f_wrapped = wrap_function.wrap_function(f1, [])
      increments = f_wrapped.prune(
          feeds=(f_wrapped.graph.get_tensor_by_name("step:0")),
          fetches=(
              f_wrapped.graph.get_operation_by_name("increment"),
              f_wrapped.graph.get_tensor_by_name("other:0"),
          ),
      )
      first_output, second_output = increments(constant_op.constant(2))
      self.assertEqual(
          ["step:0", "increment/resource:0"],
          [t.name for t in increments.inputs],
      )
      self.assertIs(None, first_output)
      self.assertEqual(1, second_output.numpy())
      self.assertEqual(3, v.numpy())
      does_not_increment = f_wrapped.prune(
          feeds=(f_wrapped.graph.get_tensor_by_name("step:0")),
          fetches=f_wrapped.graph.get_tensor_by_name("other:0"),
      )
      self.assertEqual(
          1, does_not_increment(constant_op.constant(3)).numpy()
      )
      self.assertEqual(3, v.numpy())
  
imports: import os
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import wrap_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import importer
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import init_ops
  from tensorflow.python.ops import state_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import test
  from tensorflow.python.training import saver
label_desc: Use image node_id 10 for calling the WrapFunctionTest obj's underlying member method code with example usage: obj.testPruneOperations() and returns: constant_op