提交 0265894e authored 作者: James Bergstra's avatar James Bergstra

added eq and hash for tensor.Dot

上级 fefdf2b1
...@@ -3578,6 +3578,11 @@ class Dot(Op): ...@@ -3578,6 +3578,11 @@ class Dot(Op):
""" """
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
# the rationale for Dot22 is related to getting GEMM Ops into the graph. See Dot22 in tensor.blas for details. # the rationale for Dot22 is related to getting GEMM Ops into the graph. See Dot22 in tensor.blas for details.
def make_node(self, *inputs): def make_node(self, *inputs):
......
...@@ -21,6 +21,9 @@ else: mode_not_fast_compile = config.mode ...@@ -21,6 +21,9 @@ else: mode_not_fast_compile = config.mode
mode_blas_opt = theano.compile.get_default_mode().including('BlasOpt', 'specialize') mode_blas_opt = theano.compile.get_default_mode().including('BlasOpt', 'specialize')
def test_dot_eq():
assert T.Dot() == T.Dot()
class t_gemm(TestCase): class t_gemm(TestCase):
"""This test suite is supposed to establish that gemm works as it is supposed to.""" """This test suite is supposed to establish that gemm works as it is supposed to."""
def setUp(self): def setUp(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论