Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
645d7155
提交
645d7155
authored
11月 16, 2020
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
11月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update Cython-generated Scan code
上级
e09e2b1e
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
11 行增加
和
59 行删除
+11
-59
scan_perform.c
theano/scan/c_code/scan_perform.c
+0
-0
numpy_api_changes.diff
theano/scan/numpy_api_changes.diff
+0
-51
scan_perform.pyx
theano/scan/scan_perform.pyx
+5
-3
scan_perform_ext.py
theano/scan/scan_perform_ext.py
+6
-5
没有找到文件。
theano/scan/c_code/scan_perform.c
浏览文件 @
645d7155
This source diff could not be displayed because it is too large. You can
view the blob
instead.
theano/scan/numpy_api_changes.diff
deleted
100644 → 0
浏览文件 @
e09e2b1e
@@ -6667,7 +6667,7 @@
* cdef list stack
* cdef int offset
*/
- __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
+ __pyx_t_3 = ((PyObject *)PyArray_DESCR(__pyx_v_self));
__Pyx_INCREF(__pyx_t_3);
__pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
__pyx_t_3 = 0;
@@ -8237,7 +8237,7 @@
* arr.base = baseptr
*
*/
- Py_XDECREF(__pyx_v_arr->base);
+ Py_XDECREF(PyArray_BASE(__pyx_v_arr));
/* "numpy.pxd":973
* baseptr = <PyObject*>base
@@ -8246,7 +8246,11 @@
*
* cdef inline object get_array_base(ndarray arr):
*/
- __pyx_v_arr->base = __pyx_v_baseptr;
+ #if NPY_API_VERSION < 0x00000007
+ PyArray_BASE(__pyx_v_arr) = __pyx_v_baseptr;
+ #else
+ PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_baseptr);
+ #endif
__Pyx_RefNannyFinishContext();
}
@@ -8285,7 +8285,7 @@
* return None
* else:
*/
- __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
+ __pyx_t_1 = ((PyArray_BASE(__pyx_v_arr) == NULL) != 0);
if (__pyx_t_1) {
/* "numpy.pxd":977
@@ -8307,8 +8311,8 @@
* return <object>arr.base # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
- __pyx_r = ((PyObject *)__pyx_v_arr->base);
+ __Pyx_INCREF(((PyObject *)PyArray_BASE(__pyx_v_arr)));
+ __pyx_r = ((PyObject *)PyArray_BASE(__pyx_v_arr));
goto __pyx_L0;
}
__pyx_L3:;
theano/scan/scan_perform.pyx
浏览文件 @
645d7155
# cython: language_level=3
"""
This code implements the operations that scan has to carry on when called
as a stand alone function.
...
...
@@ -64,7 +65,7 @@ from theano import gof
def get_version():
return 0.29
6
return 0.29
7
@cython.boundscheck(False)
def perform(
...
...
@@ -404,14 +405,15 @@ def perform(
# done by raise_with_op is not implemented in C.
if hasattr(fn, 'thunks'):
# For the CVM
gof.link.raise_with_op(fn.nodes[fn.position_of_error],
gof.link.raise_with_op(fn.maker.fgraph,
fn.nodes[fn.position_of_error],
fn.thunks[fn.position_of_error])
else:
# For the c linker
# We don't have access from python to all the
# temps values So for now, we just don't print
# the extra shapes/strides info
gof.
vm.raise_with_op(
fn.nodes[fn.position_of_error])
gof.
link.raise_with_op(fn.maker.fgraph,
fn.nodes[fn.position_of_error])
else:
# old-style linkers raise their own exceptions
raise
...
...
theano/scan/scan_perform_ext.py
浏览文件 @
645d7155
"""
To update the scan Cython code in Theano you must
- update the version in this file and scan_perform.py
- call "cd theano/scan/; cython scan_perform.pyx; patch scan_perform.c numpy_api_changes.diff"
To update the `Scan` Cython code you must
- update the version value in this file and `scan_perform.py`, and
- run `cython scan_perform.pyx; mv scan_perform.c c_code`
"""
...
...
@@ -24,7 +25,7 @@ from theano.gof.compilelock import get_lock, release_lock
_logger
=
logging
.
getLogger
(
"theano.scan.scan_perform"
)
version
=
0.29
6
# must match constant returned in function get_version()
version
=
0.29
7
# must match constant returned in function get_version()
need_reload
=
False
...
...
@@ -143,7 +144,7 @@ except ImportError:
release_lock
()
# This is caused as cython use the old NumPy C-API but we use the new one.
# To fix it completly, we would need to modify Cython to use the new API.
# To fix it complet
e
ly, we would need to modify Cython to use the new API.
with
warnings
.
catch_warnings
():
warnings
.
filterwarnings
(
"ignore"
,
message
=
"numpy.ndarray size changed"
)
from
scan_perform.scan_perform
import
get_version
,
perform
# noqa: F401
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论