提交 ca40ef22 authored 作者: Faruk Ahmed's avatar Faruk Ahmed 提交者: Frederic Bastien

other places

上级 1245e3c6
......@@ -1792,19 +1792,18 @@ class OpWiseCLinker(link.LocalLinker):
# There are ops that don't have _op_use_c_code property
# for example ifelse (or any ops that come with their own
# make_thunk
old_value = getattr(node.op, '_op_use_c_code', False)
try:
if theano.config.cxx:
node.op._op_use_c_code = True
if theano.config.cxx:
thunks += [node.op.make_c_thunk(node,
storage_map,
compute_map,
no_recycling)]
else:
thunks += [node.op.make_thunk(node,
storage_map,
compute_map,
no_recycling)]
thunks[-1].inputs = [storage_map[v] for v in node.inputs]
thunks[-1].outputs = [storage_map[v] for v in node.outputs]
finally:
node.op._op_use_c_code = old_value
thunks[-1].inputs = [storage_map[v] for v in node.inputs]
thunks[-1].outputs = [storage_map[v] for v in node.outputs]
for node in order:
if self.allow_gc:
......
......@@ -1044,11 +1044,15 @@ class VM_Linker(link.LocalLinker):
for node in order:
try:
if self.c_thunks is False:
node.op._op_use_c_code = False
thunks.append(node.op.make_thunk(node,
storage_map,
compute_map,
no_recycling))
thunks.append(node.op.make_py_thunk(node,
storage_map,
compute_map,
no_recycling))
else:
thunks.append(node.op.make_thunk(node,
storage_map,
compute_map,
no_recycling))
if not hasattr(thunks[-1], 'lazy'):
# We don't want all ops maker to think about lazy Ops.
# So if they didn't specify that its lazy or not, it isn't.
......
......@@ -6297,15 +6297,10 @@ def constant_folding(node):
compute_map[o] = [False]
if (hasattr(node.op, 'python_constant_folding') and
node.op.python_constant_folding(node)):
old_value = getattr(node.op, '_op_use_c_code', False)
try:
node.op._op_use_c_code = False
thunk = node.op.make_thunk(node,
storage_map,
compute_map,
[])
finally:
node.op._op_use_c_code = old_value
thunk = node.op.make_py_thunk(node,
storage_map,
compute_map,
[])
else:
thunk = node.op.make_thunk(node, storage_map, compute_map,
no_recycling=[])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论