提交 df669cc6 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Pass the context to the perform method of nodes that have a context.

上级 2c2edc8c
......@@ -741,13 +741,24 @@ class Op(utils.object2, PureOp, CLinkerOp):
# condition: either there was no c_code, or it failed
p = node.op.perform
# default arguments are stored in the closure of `rval`
def rval(p=p, i=node_input_storage, o=node_output_storage, n=node):
r = p(n, [x[0] for x in i], o)
for o in node.outputs:
compute_map[o][0] = True
return r
ctx = node.get_context()
if ctx is None:
# default arguments are stored in the closure of `rval`
def rval(p=p, i=node_input_storage, o=node_output_storage, n=node):
r = p(n, [x[0] for x in i], o)
for o in node.outputs:
compute_map[o][0] = True
return r
else:
ctx_val = node.context_type.filter(ctx)
def rval(p=p, i=node_input_storage, o=node_output_storage, n=node,
ctx=ctx_val):
r = p(n, [x[0] for x in i], o, ctx)
for o in node.outputs:
compute_map[o][0] = True
return r
rval.inputs = node_input_storage
rval.outputs = node_output_storage
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论