提交 6c110c7a authored 作者: James Bergstra's avatar James Bergstra

added values_eq_enough to Type interface (fixes #247)

上级 e023aa3e
...@@ -242,6 +242,22 @@ class PureType(object): ...@@ -242,6 +242,22 @@ class PureType(object):
r.tag.trace = traceback.extract_stack()[:-1] r.tag.trace = traceback.extract_stack()[:-1]
return r return r
def values_eq_enough(self, a, b):
"""Return True if a and b can be considered equal as Op outputs, else False.
:param a: a potential value for a Result of this Type.
:param b: a potential value for a Result of this Type.
:rtype: Bool
This function is used by theano debugging tools to decide whether two values are
equivalent, admitting a certain amount of numerical instability. For example,
for floating-point numbers this function should be an approximate comparison.
"""
return (a == b)
_nothing = """ _nothing = """
""" """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论