提交 bef27274 authored 作者: James Bergstra's avatar James Bergstra

Defined hash, eq, and str methods for the Shape op.

上级 8d803f8c
...@@ -935,6 +935,12 @@ class Shape(Op): ...@@ -935,6 +935,12 @@ class Shape(Op):
@note: Non-differentiable. @note: Non-differentiable.
""" """
def __hash__(self):
return hash(type(self))
def __eq__(self, other):
return type(self) == type(other)
def __str__(self):
return self.__class__.__name__
def make_node(self, x): def make_node(self, x):
x = as_tensor_variable(x) x = as_tensor_variable(x)
return Apply(self, [x], [lvector()]) return Apply(self, [x], [lvector()])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论