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

bypass the add stack trace in some cases

上级 65defd12
...@@ -526,7 +526,8 @@ class Elemwise(OpenMPOp): ...@@ -526,7 +526,8 @@ class Elemwise(OpenMPOp):
""" """
inputs = map(as_tensor_variable, inputs) inputs = map(as_tensor_variable, inputs)
shadow = self.scalar_op.make_node( shadow = self.scalar_op.make_node(
*[get_scalar_type(dtype=i.type.dtype)() for i in inputs]) *[get_scalar_type(dtype=i.type.dtype).make_variable()
for i in inputs])
target_length = max([input.type.ndim for input in inputs]) target_length = max([input.type.ndim for input in inputs])
...@@ -1029,9 +1030,9 @@ class Elemwise(OpenMPOp): ...@@ -1029,9 +1030,9 @@ class Elemwise(OpenMPOp):
# We generate the C code of the inner loop using the scalar op # We generate the C code of the inner loop using the scalar op
task_code = self.scalar_op.c_code( task_code = self.scalar_op.c_code(
Apply(self.scalar_op, Apply(self.scalar_op,
[get_scalar_type(dtype=input.type.dtype)() [get_scalar_type(dtype=input.type.dtype).make_variable()
for input in node.inputs], for input in node.inputs],
[get_scalar_type(dtype=output.type.dtype)() [get_scalar_type(dtype=output.type.dtype).make_variable()
for output in node.outputs]), for output in node.outputs]),
nodename + '_scalar_', nodename + '_scalar_',
["%s_i" % s for s in _inames], ["%s_i" % s for s in _inames],
...@@ -1182,8 +1183,10 @@ class Elemwise(OpenMPOp): ...@@ -1182,8 +1183,10 @@ class Elemwise(OpenMPOp):
# now we insert versions for the ops on which we depend... # now we insert versions for the ops on which we depend...
scalar_node = Apply(self.scalar_op, scalar_node = Apply(self.scalar_op,
[get_scalar_type(dtype=input.type.dtype)() for input in node.inputs], [get_scalar_type(dtype=input.type.dtype).make_variable()
[get_scalar_type(dtype=output.type.dtype)() for output in node.outputs]) for input in node.inputs],
[get_scalar_type(dtype=output.type.dtype).make_variable()
for output in node.outputs])
version.append(self.scalar_op.c_code_cache_version_apply(scalar_node)) version.append(self.scalar_op.c_code_cache_version_apply(scalar_node))
for i in node.inputs + node.outputs: for i in node.inputs + node.outputs:
version.append(get_scalar_type(dtype=i.type.dtype).c_code_cache_version()) version.append(get_scalar_type(dtype=i.type.dtype).c_code_cache_version())
...@@ -1560,9 +1563,9 @@ for(int i=0;i<PyArray_NDIM(%(iname)s);i++){ ...@@ -1560,9 +1563,9 @@ for(int i=0;i<PyArray_NDIM(%(iname)s);i++){
task1_code = self.scalar_op.c_code( task1_code = self.scalar_op.c_code(
Apply( Apply(
self.scalar_op, self.scalar_op,
[get_scalar_type(dtype=input.type.dtype)() [get_scalar_type(dtype=input.type.dtype).make_variable()
for input in (node.inputs * 2)], for input in (node.inputs * 2)],
[get_scalar_type(dtype=output.type.dtype)() [get_scalar_type(dtype=output.type.dtype).make_variable()
for input in node.outputs]), for input in node.outputs]),
None, None,
["%s_i" % aname, "%s_i" % inames[0]], ["%s_i" % aname, "%s_i" % inames[0]],
...@@ -1612,8 +1615,10 @@ for(int i=0;i<PyArray_NDIM(%(iname)s);i++){ ...@@ -1612,8 +1615,10 @@ for(int i=0;i<PyArray_NDIM(%(iname)s);i++){
# now we insert versions for the ops on which we depend... # now we insert versions for the ops on which we depend...
scalar_node = Apply(self.scalar_op, scalar_node = Apply(self.scalar_op,
[get_scalar_type(dtype=input.type.dtype)() for input in node.inputs], [get_scalar_type(dtype=input.type.dtype).make_variable()
[get_scalar_type(dtype=output.type.dtype)() for output in node.outputs]) for input in node.inputs],
[get_scalar_type(dtype=output.type.dtype).make_variable()
for output in node.outputs])
version.append(self.scalar_op.c_code_cache_version_apply(scalar_node)) version.append(self.scalar_op.c_code_cache_version_apply(scalar_node))
for i in node.inputs + node.outputs: for i in node.inputs + node.outputs:
version.append(get_scalar_type(dtype=i.type.dtype).c_code_cache_version()) version.append(get_scalar_type(dtype=i.type.dtype).c_code_cache_version())
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论