提交 571f3368 authored 作者: Frederic's avatar Frederic

Fix compilation crash introduced in this PR.

上级 d7a67b73
...@@ -616,15 +616,15 @@ theano.compile.register_view_op_c_code( ...@@ -616,15 +616,15 @@ theano.compile.register_view_op_c_code(
theano.compile.register_shape_c_code( theano.compile.register_shape_c_code(
TensorType, TensorType,
""" """
npy_intp shape[] = {PyArray_NDIM(%(inames)s)}; npy_intp shape[] = {PyArray_NDIM(%(iname)s)};
if(%(onames)s == NULL || (PyArray_DIMS(%(onames)s)[0] != shape[0])) if(%(oname)s == NULL || (PyArray_DIMS(%(oname)s)[0] != shape[0]))
{ {
Py_XDECREF(%(onames)s); Py_XDECREF(%(oname)s);
%(onames)s = (PyArrayObject*) PyArray_SimpleNew(1, shape, NPY_INT64); %(oname)s = (PyArrayObject*) PyArray_SimpleNew(1, shape, NPY_INT64);
} }
for(int i=0;i<shape[0];i++) for(int i=0;i<shape[0];i++)
{ {
((npy_int64*)PyArray_GETPTR1(%(onames)s, i))[0] = PyArray_DIMS(%(inames)s)[i]; ((npy_int64*)PyArray_GETPTR1(%(oname)s, i))[0] = PyArray_DIMS(%(iname)s)[i];
} }
""", """,
version=1) version=1)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论