Пример #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