提交 ab9078d6 authored 作者: Iban Harlouchet's avatar Iban Harlouchet

Added corrections to ops.py

上级 c210ef51
...@@ -465,7 +465,6 @@ class FromFunctionOp(gof.Op): ...@@ -465,7 +465,6 @@ class FromFunctionOp(gof.Op):
raise an error if you attempt to get the gradient of a graph raise an error if you attempt to get the gradient of a graph
containing this op. containing this op.
""" """
__props__ = ("fn", "itypes", "otypes", "infer_shape")
def __init__(self, fn, itypes, otypes, infer_shape): def __init__(self, fn, itypes, otypes, infer_shape):
self.__fn = fn self.__fn = fn
...@@ -475,6 +474,13 @@ class FromFunctionOp(gof.Op): ...@@ -475,6 +474,13 @@ class FromFunctionOp(gof.Op):
if self.__infer_shape is not None: if self.__infer_shape is not None:
self.infer_shape = self._infer_shape self.infer_shape = self._infer_shape
def __eq__(self, other):
return (type(self) == type(other) and
self.__fn == other.__fn)
def __hash__(self):
return hash(type(self)) ^ hash(self.__fn)
def __str__(self): def __str__(self):
return 'FromFunctionOp{%s}' % self.__fn.__name__ return 'FromFunctionOp{%s}' % self.__fn.__name__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论