提交 d84aeb51 authored 作者: Frederic Bastien's avatar Frederic Bastien

Op.prepare_node should modify node inplace and not return a new one. Needed by next commit.

上级 758e0c30
...@@ -1838,9 +1838,7 @@ class _Linker(gof.link.LocalLinker): ...@@ -1838,9 +1838,7 @@ class _Linker(gof.link.LocalLinker):
thunk.outputs = [storage_map[v] for v in node.outputs] thunk.outputs = [storage_map[v] for v in node.outputs]
thunk_other = thunk thunk_other = thunk
else: else:
new_node = node.op.prepare_node(node, storage_map, compute_map) node.op.prepare_node(node, storage_map, compute_map)
if new_node is not None:
node = new_node
debug = hasattr(node.op, 'debug_perform') debug = hasattr(node.op, 'debug_perform')
......
...@@ -795,7 +795,7 @@ class Op(utils.object2, PureOp, CLinkerOp): ...@@ -795,7 +795,7 @@ class Op(utils.object2, PureOp, CLinkerOp):
Make any special modifications that the Op needs before doing Make any special modifications that the Op needs before doing
make_thunk(). make_thunk().
This can either modify the node inplace or return a new one. This can modify the node inplace and should return nothing.
""" """
pass pass
...@@ -916,10 +916,9 @@ class Op(utils.object2, PureOp, CLinkerOp): ...@@ -916,10 +916,9 @@ class Op(utils.object2, PureOp, CLinkerOp):
""" """
logger = logging.getLogger('theano.gof.op.Op') logger = logging.getLogger('theano.gof.op.Op')
new_node = self.prepare_node(node, storage_map=storage_map, self.prepare_node(node, storage_map=storage_map,
compute_map=compute_map) compute_map=compute_map)
if new_node is not None:
node = new_node
if not hasattr(self, '_op_use_c_code'): if not hasattr(self, '_op_use_c_code'):
warnings.warn( warnings.warn(
"The __getstate__ method of '%s' is not implemented correctly." "The __getstate__ method of '%s' is not implemented correctly."
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论