提交 4d471ab8 authored 作者: Frederic's avatar Frederic

[Test] fix tests failure in debugmode.

上级 b44e2bbf
......@@ -44,6 +44,14 @@ class MyType(Type):
raise ValueError("Invalid value")
return x
# Added to make those tests pass in DebugMode
@staticmethod
def may_share_memory(a, b):
# As this represent a string and string are immutable, they
# never share memory in the DebugMode sence. This is needed as
# Python reuse string internally.
return False
class MyOp(Op):
......
......@@ -64,6 +64,11 @@ class T_extending(unittest.TestCase):
def values_eq_approx(self, x, y, tolerance=1e-4):
return abs(x - y) / (abs(x) + abs(y)) < tolerance
# Added to make those tests pass in DebugMode
@staticmethod
def may_share_memory(a, b):
return a is b
double = Double()
......@@ -87,6 +92,11 @@ class T_extending(unittest.TestCase):
def __str__(self):
return "double"
# Added to make those tests pass in DebugMode
@staticmethod
def may_share_memory(a, b):
return a is b
double = Double()
......@@ -194,6 +204,11 @@ class T_extending(unittest.TestCase):
def __str__(self):
return "double"
# Added to make those tests pass in DebugMode
@staticmethod
def may_share_memory(a, b):
return a is b
double = Double()
class BinaryDoubleOp(gof.Op):
......@@ -341,6 +356,11 @@ class T_extending(unittest.TestCase):
def c_cleanup(self, name, sub):
return ""
# Added to make those tests pass in DebugMode
@staticmethod
def may_share_memory(a, b):
return a is b
double = Double()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论