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

Make sure Elemwise and Composite prepare_node is called

上级 23e43b1b
......@@ -3667,9 +3667,10 @@ class Composite(ScalarOp):
def prepare_node(self, node, storage_map, compute_map, impl):
if impl == 'py':
self.init_py_impls() # self._impls
elif impl == 'c':
if not getattr(node.tag, 'graph_prepare_node_called', False):
for n in theano.gof.graph.list_of_nodes(self.inputs, self.outputs):
n.op.prepare_node(n, None, None, impl)
node.tag.graph_prepare_node_called = True
def output_types(self, input_types):
if tuple(input_types) != self.inputs_type:
......
......@@ -891,6 +891,14 @@ second dimension
# numpy the first (faster) version leads to segfaults
if self.ufunc:
ufunc = self.ufunc
elif not hasattr(node.tag, 'ufunc'):
# It happen that make_thunk isn't called, like in
# get_scalar_constant_value
self.prepare_node(node, None, None, 'py')
if self.ufunc:
ufunc = self.ufunc
else:
ufunc = node.tag.ufunc
else:
ufunc = node.tag.ufunc
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论