code: def testPrintInDefunWithoutExplicitEvalOfPrint(self):
      tensor = math_ops.range(10)
  
      @def_function.function
      def f(tensor):
          logging_ops.print_v2(tensor)
          return tensor
  
      expected = "[0 1 2 ... 7 8 9]"
      with self.captureWritesToStream(sys.stderr) as printed_one:
          x = f(tensor)
          self.evaluate(x)
      self.assertIn((expected + "\n"), printed_one.contents())
  
      # We execute the function again to make sure it doesn't only print on the
      # first call.
      with self.captureWritesToStream(sys.stderr) as printed_two:
          y = f(tensor)
          self.evaluate(y)
      self.assertIn((expected + "\n"), printed_two.contents())
  
imports: import os
  import string
  import sys
  import tempfile
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import control_flow_assert
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import logging_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import string_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 23 for calling the PrintV2Test obj's underlying member method code with example usage: obj.testPrintInDefunWithoutExplicitEvalOfPrint() and returns: tensor