예제 #1
0
 def _testAddShouldUseWarningWhenUsed(self, fn, name):
   c = constant_op.constant(0, name=name)
   with reroute_error() as error:
     h = tf_should_use._add_should_use_warning(c, warn_in_eager=True)
     fn(h)
     del h
   error.assert_not_called()
예제 #2
0
 def _testAddShouldUseWarningWhenUsed(self, fn, name):
     c = constant_op.constant(0, name=name)
     with reroute_error() as (error, fatal):
         h = tf_should_use._add_should_use_warning(c)
         fn(h)
         del h
     error.assert_not_called()
     fatal.assert_not_called()
예제 #3
0
 def _testAddShouldUseWarningWhenUsed(self, fn, name):
   c = constant_op.constant(0, name=name)
   with reroute_error() as (error, fatal):
     h = tf_should_use._add_should_use_warning(c)
     fn(h)
     del h
   error.assert_not_called()
   fatal.assert_not_called()
예제 #4
0
 def _testAddShouldUseWarningWhenUsed(self, fn):
     c = constant_op.constant(0, name='blah')
     captured = []
     with reroute_error(captured):
         h = tf_should_use._add_should_use_warning(c)
         fn(h)
         del h
     self.assertNotIn('Object was never used', '\n'.join(captured))
     self.assertNotIn('blah:0', '\n'.join(captured))
예제 #5
0
 def _testAddShouldUseWarningWhenUsed(self, fn):
   c = constant_op.constant(0, name='blah')
   captured = []
   with reroute_error(captured):
     h = tf_should_use._add_should_use_warning(c)
     fn(h)
     del h
   self.assertNotIn('Object was never used:', '\n'.join(captured))
   self.assertNotIn('blah:0', '\n'.join(captured))
예제 #6
0
 def in_this_function():
     h = tf_should_use._add_should_use_warning(c, fatal_error=True)
     del h
예제 #7
0
 def in_this_function():
     h = tf_should_use._add_should_use_warning(c)
     del h
예제 #8
0
 def in_this_function():
   h = tf_should_use._add_should_use_warning(c, fatal_error=True)
   del h
예제 #9
0
 def in_this_function():
   h = tf_should_use._add_should_use_warning(c)
   del h
예제 #10
0
 def in_this_function():
   c = constant_op.constant(0, name='blah0')
   h = tf_should_use._add_should_use_warning(
       c, warn_in_eager=True, error_in_function=True)
   del h
예제 #11
0
 def in_this_function():
   h = tf_should_use._add_should_use_warning(c, warn_in_eager=True)
   del h