提交 13c2b145 authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix the test following more caching of constant.

上级 072d5d33
...@@ -346,7 +346,14 @@ class TestAutoName: ...@@ -346,7 +346,14 @@ class TestAutoName:
r1 = tensor.constant(1.5) r1 = tensor.constant(1.5)
r2 = tensor.constant(1.5) r2 = tensor.constant(1.5)
assert r1.auto_name == "auto_" + str(autoname_id) assert r1.auto_name == "auto_" + str(autoname_id)
assert r2.auto_name == "auto_" + str(autoname_id + 1) # We reuse the same variable
assert r2.auto_name == "auto_" + str(autoname_id)
assert r1 is r2
r3 = tensor.constant(1.6)
# The cache still create a new object that we don't return.
# This is why we must increase by 2 and not 1.
assert r3.auto_name == "auto_" + str(autoname_id + 2)
def test_tensorvariable(self): def test_tensorvariable(self):
# Get counter value # Get counter value
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论