提交 4e3c6ffa authored 作者: Frederic's avatar Frederic

Check the alignment after we check we got a return value!

上级 e0d4ff2a
......@@ -5973,7 +5973,7 @@ class Reshape(Op):
return [tuple(oshape)]
def c_code_cache_version(self):
return (3,)
return (4,)
def c_code(self, node, name, inputs, outputs, sub):
if isinstance(node.inputs[0], TensorVariable):
......@@ -6000,16 +6000,16 @@ class Reshape(Op):
Py_XDECREF(%(z)s);
%(z)s = (PyArrayObject *) PyArray_Newshape(%(x)s, &newshape,
PyArray_CORDER);
if (!PyArray_ISALIGNED(%(z)s)) {
PyErr_Format(PyExc_RuntimeError, "PyArray_Newshape returned an object that isn't aligned!");
%(fail)s;
}
if (!%(z)s)
{
PyErr_Format(PyExc_ValueError,
"Could not reshape array.");
%(fail)s;
}
if (!PyArray_ISALIGNED(%(z)s)) {
PyErr_Format(PyExc_RuntimeError, "PyArray_Newshape returned an object that isn't aligned!");
%(fail)s;
}
""" % locals()
else:
return Op.c_code(self, node, name, inputs, outputs, sub)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论