[英]test_session deprecation warning when instantiating tf.test.TestCase
I know that test_session
is deprecated in tensorflow 1.13
:我知道test_session
在tensorflow 1.13
已被弃用:
Warning: THIS FUNCTION IS DEPRECATED.警告:此功能已弃用。 It will be removed in a future version.它将在未来版本中删除。 Instructions for updating: Use self.session() or self.cached_session() instead.更新说明:使用 self.session() 或 self.cached_session() 代替。
I created a unit test by only inheriting from tf.test.TestCase
(which as I understand it is not deprecated?).我仅通过从tf.test.TestCase
继承创建了一个单元测试(据我所知它没有被弃用?)。 I was careful not to explicitly call test_session
:我很小心没有显式调用test_session
:
class TestModelFn(tf.test.TestCase):
def test_nothing(self):
pass
However, when I run this test I see this:但是,当我运行此测试时,我看到:
test_nothing (the_thing.test.objective.cost_based.test_model.TestModelFn) ... ok
test_session (the_thing.test.objective.cost_based.test_model.TestModelFn)
Use cached_session instead. (deprecated) ... skipped 'Not a test.'
Why is this happening?为什么会这样? I'm using tensorflow 1.13.1
.我正在使用tensorflow 1.13.1
。
发生这种情况是因为test_session
的命名类似于测试方法,因此您的测试运行程序将尝试运行它,从而触发弃用警告和'Not a test'
消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.