Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
66c970d8
提交
66c970d8
authored
9月 05, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add the NPY_NO_DEPRECATED_API and NPY_ARRAY_ENSURECOPY flags due to numpy 1.7 changes.
上级
1b293e81
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
15 行增加
和
9 行删除
+15
-9
fibby.txt
doc/extending/fibby.txt
+2
-2
cmodule.py
theano/gof/cmodule.py
+6
-0
rng_mrg.py
theano/sandbox/rng_mrg.py
+2
-2
basic.py
theano/tensor/basic.py
+1
-1
elemwise.py
theano/tensor/elemwise.py
+3
-3
test_tutorial.py
theano/tests/test_tutorial.py
+1
-1
没有找到文件。
doc/extending/fibby.txt
浏览文件 @
66c970d8
...
@@ -63,7 +63,7 @@ you should check the strides and alignment.
...
@@ -63,7 +63,7 @@ you should check the strides and alignment.
return """
return """
Py_XDECREF(%(y)s);
Py_XDECREF(%(y)s);
%(y)s = (PyArrayObject*)PyArray_FromArray(
%(y)s = (PyArrayObject*)PyArray_FromArray(
%(x)s, 0, NPY_ENSURECOPY);
%(x)s, 0, NPY_
ARRAY_
ENSURECOPY);
if (!(%y)s) %(fail)s;
if (!(%y)s) %(fail)s;
dtype_%(y)s * y = (dtype_%(y)s*)%(y)s->data;
dtype_%(y)s * y = (dtype_%(y)s*)%(y)s->data;
dtype_%(x)s * x = (dtype_%(x)s*)%(x)s->data;
dtype_%(x)s * x = (dtype_%(x)s*)%(x)s->data;
...
@@ -147,7 +147,7 @@ the correct size for the output. This is essentially simulating the line
...
@@ -147,7 +147,7 @@ the correct size for the output. This is essentially simulating the line
Py_XDECREF(%(y)s);
Py_XDECREF(%(y)s);
%(y)s = (PyArrayObject*)PyArray_FromArray(
%(y)s = (PyArrayObject*)PyArray_FromArray(
%(x)s, 0, NPY_ENSURECOPY);
%(x)s, 0, NPY_
ARRAY_
ENSURECOPY);
The first line reduces the reference count of the data that y originally
The first line reduces the reference count of the data that y originally
pointed to. The second line allocates the new data and makes y point to it.
pointed to. The second line allocates the new data and makes y point to it.
...
...
theano/gof/cmodule.py
浏览文件 @
66c970d8
...
@@ -1453,6 +1453,12 @@ class GCC_compiler(object):
...
@@ -1453,6 +1453,12 @@ class GCC_compiler(object):
@staticmethod
@staticmethod
def
compile_args
():
def
compile_args
():
cxxflags
=
[
flag
for
flag
in
config
.
gcc
.
cxxflags
.
split
(
' '
)
if
flag
]
cxxflags
=
[
flag
for
flag
in
config
.
gcc
.
cxxflags
.
split
(
' '
)
if
flag
]
cxxflags
.
append
(
"-D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION"
)
numpy_ver
=
[
int
(
n
)
for
n
in
numpy
.
__version__
.
split
(
'.'
)[:
2
]]
# numpy 1.7b1 replaced NPY_ENSURECOPY to NPY_ARRAY_ENSURECOPY
# that didn't existed
if
bool
(
numpy_ver
<
[
1
,
7
]):
cxxflags
.
append
(
"-D NPY_ARRAY_ENSURECOPY=NPY_ENSURECOPY"
)
return
cxxflags
return
cxxflags
@staticmethod
@staticmethod
...
...
theano/sandbox/rng_mrg.py
浏览文件 @
66c970d8
...
@@ -220,9 +220,9 @@ class mrg_uniform(mrg_uniform_base):
...
@@ -220,9 +220,9 @@ class mrg_uniform(mrg_uniform_base):
rstate
,
size
=
inp
rstate
,
size
=
inp
o_rstate
,
o_sample
=
out
o_rstate
,
o_sample
=
out
if
self
.
inplace
:
if
self
.
inplace
:
o_rstate_requirement
=
'NPY_C_CONTIGUOUS|NPY_ALIGNED'
o_rstate_requirement
=
'NPY_C_CONTIGUOUS|NPY_A
RRAY_A
LIGNED'
else
:
else
:
o_rstate_requirement
=
'NPY_
ENSURECOPY|NPY_C_CONTIGUOUS|NP
Y_ALIGNED'
o_rstate_requirement
=
'NPY_
ARRAY_ENSURECOPY|NPY_C_CONTIGUOUS|NPY_ARRA
Y_ALIGNED'
ndim
=
self
.
output_type
.
ndim
ndim
=
self
.
output_type
.
ndim
o_type_num
=
numpy
.
asarray
(
0
,
dtype
=
self
.
output_type
.
dtype
)
.
dtype
.
num
o_type_num
=
numpy
.
asarray
(
0
,
dtype
=
self
.
output_type
.
dtype
)
.
dtype
.
num
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
...
...
theano/tensor/basic.py
浏览文件 @
66c970d8
...
@@ -4504,7 +4504,7 @@ class IncSubtensor(Op):
...
@@ -4504,7 +4504,7 @@ class IncSubtensor(Op):
{
{
if (
%(z)
s) Py_DECREF(
%(z)
s);
if (
%(z)
s) Py_DECREF(
%(z)
s);
%(z)
s = (PyArrayObject*)PyArray_FromAny(py_
%(x)
s, NULL, 0, 0,
%(z)
s = (PyArrayObject*)PyArray_FromAny(py_
%(x)
s, NULL, 0, 0,
NPY_ENSURECOPY, NULL);
NPY_
ARRAY_
ENSURECOPY, NULL);
}
}
"""
%
locals
()
"""
%
locals
()
...
...
theano/tensor/elemwise.py
浏览文件 @
66c970d8
...
@@ -282,7 +282,7 @@ class DimShuffle(Op):
...
@@ -282,7 +282,7 @@ class DimShuffle(Op):
'{ PyArrayObject *
%(basename)
s =
%(input)
s'
,
'Py_INCREF((PyObject*)
%(basename)
s)'
]
'{ PyArrayObject *
%(basename)
s =
%(input)
s'
,
'Py_INCREF((PyObject*)
%(basename)
s)'
]
else
:
else
:
get_base
=
[(
'{ PyArrayObject *
%(basename)
s = (PyArrayObject*)PyArray_FromAny((PyObject*)
%(input)
s, NULL,'
get_base
=
[(
'{ PyArrayObject *
%(basename)
s = (PyArrayObject*)PyArray_FromAny((PyObject*)
%(input)
s, NULL,'
'0, 0, NPY_A
LIGNED|NP
Y_ENSURECOPY, NULL)'
)]
'0, 0, NPY_A
RRAY_ALIGNED|NPY_ARRA
Y_ENSURECOPY, NULL)'
)]
shape_statements
=
[
'npy_intp dimensions[
%
i]'
%
nd_out
]
shape_statements
=
[
'npy_intp dimensions[
%
i]'
%
nd_out
]
for
i
,
o
in
enumerate
(
self
.
new_order
):
for
i
,
o
in
enumerate
(
self
.
new_order
):
...
@@ -329,9 +329,9 @@ class DimShuffle(Op):
...
@@ -329,9 +329,9 @@ class DimShuffle(Op):
'PyArray_DATA(
%(basename)
s), PyArray_ITEMSIZE(
%(basename)
s), '
'PyArray_DATA(
%(basename)
s), PyArray_ITEMSIZE(
%(basename)
s), '
#borrow only the writable flag from the base
#borrow only the writable flag from the base
# the NPY_OWNDATA flag will default to 0.
# the NPY_OWNDATA flag will default to 0.
'(NPY_WRITEABLE*PyArray_ISWRITEABLE(
%(basename)
s)), NULL)'
),
'(NPY_
ARRAY_
WRITEABLE*PyArray_ISWRITEABLE(
%(basename)
s)), NULL)'
),
#recalculate flags: CONTIGUOUS, FORTRAN, ALIGNED
#recalculate flags: CONTIGUOUS, FORTRAN, ALIGNED
'PyArray_UpdateFlags(
%(res)
s, NPY_UPDATE_ALL)'
,
'PyArray_UpdateFlags(
%(res)
s, NPY_
ARRAY_
UPDATE_ALL)'
,
#we are making a view in both inplace and non-inplace cases
#we are making a view in both inplace and non-inplace cases
'PyArray_BASE(
%(res)
s) = (PyObject*)
%(basename)
s'
,
'PyArray_BASE(
%(res)
s) = (PyObject*)
%(basename)
s'
,
'}'
]
'}'
]
...
...
theano/tests/test_tutorial.py
浏览文件 @
66c970d8
...
@@ -918,7 +918,7 @@ class T_fibby(unittest.TestCase):
...
@@ -918,7 +918,7 @@ class T_fibby(unittest.TestCase):
return
"""
return
"""
Py_XDECREF(
%(y)
s);
Py_XDECREF(
%(y)
s);
%(y)
s = (PyArrayObject*)PyArray_FromArray(
%(y)
s = (PyArrayObject*)PyArray_FromArray(
%(x)
s, 0, NPY_ENSURECOPY);
%(x)
s, 0, NPY_
ARRAY_
ENSURECOPY);
if (!(
%
y)s)
%(fail)
s;
if (!(
%
y)s)
%(fail)
s;
dtype_
%(y)
s * y = (dtype_
%(y)
s*)
%(y)
s->data;
dtype_
%(y)
s * y = (dtype_
%(y)
s*)
%(y)
s->data;
dtype_
%(x)
s * x = (dtype_
%(x)
s*)
%(x)
s->data;
dtype_
%(x)
s * x = (dtype_
%(x)
s*)
%(x)
s->data;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论