提交 5d947b88 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Reverted 46bbf0aab916 because it could be potentially dangerous

上级 ffaa8e76
...@@ -1923,7 +1923,7 @@ class Composite(ScalarOp): ...@@ -1923,7 +1923,7 @@ class Composite(ScalarOp):
super(Composite,out).__init__(output_types_preference, name) super(Composite,out).__init__(output_types_preference, name)
return out return out
def __init__(self, inputs, outputs, rehash=True): def __init__(self, inputs, outputs):
self.inputs=copy(inputs) self.inputs=copy(inputs)
self.outputs=copy(outputs) self.outputs=copy(outputs)
...@@ -2004,8 +2004,7 @@ class Composite(ScalarOp): ...@@ -2004,8 +2004,7 @@ class Composite(ScalarOp):
self.env = env self.env = env
self.inputs_type = tuple([input.type for input in self.env.inputs]) self.inputs_type = tuple([input.type for input in self.env.inputs])
self.outputs_type = tuple([output.type for output in self.env.outputs]) self.outputs_type = tuple([output.type for output in self.env.outputs])
if rehash: self._rehash()
self._rehash()
def output_types(self, input_types): def output_types(self, input_types):
if tuple(input_types) != self.inputs_type: if tuple(input_types) != self.inputs_type:
...@@ -2078,7 +2077,4 @@ class Composite(ScalarOp): ...@@ -2078,7 +2077,4 @@ class Composite(ScalarOp):
self.__dict__.update(d) self.__dict__.update(d)
# We must call init to set env and _impls again, as otherwise # We must call init to set env and _impls again, as otherwise
# self.perform will not work. # self.perform will not work.
# However, we should not call `_rehash` because it may yield a self.__init__(self.inputs, self.outputs)
# different hash if some config options have changed, which would make
# the loaded object look different from the original.
self.__init__(self.inputs, self.outputs, rehash=False)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论