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()
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()
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()
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))
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))
def in_this_function(): h = tf_should_use._add_should_use_warning(c, fatal_error=True) del h
def in_this_function(): h = tf_should_use._add_should_use_warning(c) del h
def in_this_function(): h = tf_should_use._add_should_use_warning(c, fatal_error=True) del h
def in_this_function(): h = tf_should_use._add_should_use_warning(c) del h
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
def in_this_function(): h = tf_should_use._add_should_use_warning(c, warn_in_eager=True) del h