提交 3e66f333 authored 作者: Frederic's avatar Frederic

Allow dict to be passed in props

上级 357c85bf
...@@ -678,7 +678,16 @@ class Op(utils.object2, PureOp, CLinkerOp): ...@@ -678,7 +678,16 @@ class Op(utils.object2, PureOp, CLinkerOp):
def __hash__(self): def __hash__(self):
if hasattr(self, '__props__'): if hasattr(self, '__props__'):
return hash((type(self), self._props())) dicts = []
props = []
for elem in self._props():
if isinstance(elem, dict):
dicts.append(elem)
else:
props.append(elem)
h = hash((type(self), tuple(props),
tuple(utils.hash_from_dict(elem) for elem in dicts)))
return h
else: else:
return super(Op, self).__hash__() return super(Op, self).__hash__()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论