Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
116ad0f3
提交
116ad0f3
authored
2月 20, 2013
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1230 from nouiz/fix_align
Fix align
上级
de05e842
4e3c6ffa
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
61 行增加
和
18 行删除
+61
-18
.mailmap
.mailmap
+1
-0
.travis.yml
.travis.yml
+2
-0
printing.py
theano/printing.py
+4
-3
basic.py
theano/tensor/basic.py
+52
-14
elemwise.py
theano/tensor/elemwise.py
+2
-1
没有找到文件。
.mailmap
浏览文件 @
116ad0f3
...
...
@@ -8,6 +8,7 @@
# # This file is up-to-date if the command git log --format="%aN <%aE>" | sort -u
# # gives no duplicates.
Rami Al-Rfou' <rmyeid@gmail.com> Rami Al-Rfou <rmyeid@gmail.com>
<abergeron@gmail.com> <anakha@kami.(none)>
David Warde-Farley <wardefar@iro.umontreal.ca> David Warde-Farley <dwf@cs.toronto.edu>
David Warde-Farley <wardefar@iro.umontreal.ca> David Warde Farley <dwf@cs.toronto.edu>
...
...
.travis.yml
浏览文件 @
116ad0f3
...
...
@@ -23,6 +23,8 @@ env:
script
:
-
export THEANO_FLAGS=warn.ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise
-
python --version
-
uname -a
-
free
-
echo $PART
-
theano-nose $PART
...
...
theano/printing.py
浏览文件 @
116ad0f3
...
...
@@ -478,14 +478,15 @@ default_colorCodes = {'GpuFromHost': 'red',
'Scan'
:
'yellow'
,
'Shape'
:
'cyan'
,
'IfElse'
:
'magenta'
,
'Elemwise'
:
'#FFAABB'
,
'Subtensor'
:
'#FFAAFF'
}
'Elemwise'
:
'#FFAABB'
,
# dark pink
'Subtensor'
:
'#FFAAFF'
,
# purple
'Alloc'
:
'#FFAA22'
}
# orange
def
pydotprint
(
fct
,
outfile
=
None
,
compact
=
True
,
format
=
'png'
,
with_ids
=
False
,
high_contrast
=
True
,
cond_highlight
=
None
,
colorCodes
=
None
,
max_label_size
=
5
0
,
scan_graphs
=
False
,
max_label_size
=
7
0
,
scan_graphs
=
False
,
var_with_name_simple
=
False
,
print_output_file
=
True
,
assert_nb_all_strings
=-
1
...
...
theano/tensor/basic.py
浏览文件 @
116ad0f3
...
...
@@ -1062,23 +1062,24 @@ class TensorType(Type):
type_num_
%(name)
s = ((PyArrayObject*)py_
%(name)
s)->descr->type_num;
if (!PyArray_ISALIGNED(py_
%(name)
s)) {
PyErr_Format(PyExc_NotImplementedError,
"expected an aligned array of type
%%
d "
"(
%(type_num)
s), got non-aligned array of type
%%
d"
" with
%%
d dimensions, with 3 last dims
%%
d,
%%
d,
%%
d"
" and 3 last strides
%%
d
%%
d,
%%
d.",
%(type_num)
s, type_num_
%(name)
s,
PyArray_NDIM(py_
%(name)
s),
PyArray_NDIM(py_
%(name)
s) >= 3 ?
"expected an aligned array of type
%%
ld "
"(
%(type_num)
s), got non-aligned array of type
%%
ld"
" with
%%
ld dimensions, with 3 last dims
%%
ld,
%%
ld,
%%
ld"
" and 3 last strides
%%
ld
%%
ld,
%%
ld.",
(long int)
%(type_num)
s,
(long int) type_num_
%(name)
s,
(long int) PyArray_NDIM(py_
%(name)
s),
(long int) PyArray_NDIM(py_
%(name)
s) >= 3 ?
PyArray_DIMS(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-3] : -1,
PyArray_NDIM(py_
%(name)
s) >= 2 ?
(long int)
PyArray_NDIM(py_
%(name)
s) >= 2 ?
PyArray_DIMS(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-2] : -1,
PyArray_NDIM(py_
%(name)
s) >= 1 ?
(long int)
PyArray_NDIM(py_
%(name)
s) >= 1 ?
PyArray_DIMS(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-1] : -1,
PyArray_NDIM(py_
%(name)
s) >= 2
?
(long int) PyArray_NDIM(py_
%(name)
s) >= 3
?
PyArray_STRIDES(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-3] : -1,
PyArray_NDIM(py_
%(name)
s) >= 3
?
(long int) PyArray_NDIM(py_
%(name)
s) >= 2
?
PyArray_STRIDES(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-2] : -1,
PyArray_NDIM(py_
%(name)
s) >= 1 ?
(long int)
PyArray_NDIM(py_
%(name)
s) >= 1 ?
PyArray_STRIDES(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-1] : -1
);
%(fail)
s
...
...
@@ -1105,6 +1106,8 @@ class TensorType(Type):
def
c_sync
(
self
,
name
,
sub
):
"""Override `CLinkerOp.c_sync` """
fail
=
sub
[
'fail'
]
type_num
=
self
.
dtype_specs
()[
2
]
return
"""
{Py_XDECREF(py_
%(name)
s);}
if (!
%(name)
s) {
...
...
@@ -1114,7 +1117,33 @@ class TensorType(Type):
else if ((void*)py_
%(name)
s != (void*)
%(name)
s) {
py_
%(name)
s = (PyObject*)
%(name)
s;
}
{Py_XINCREF(py_
%(name)
s);}
if (!PyArray_ISALIGNED(py_
%(name)
s)) {
PyErr_Format(PyExc_NotImplementedError,
"c_sync: expected an aligned array of type
%%
ld "
"(
%(type_num)
s), got non-aligned array of type
%%
ld"
" with
%%
ld dimensions, with 3 last dims
%%
ld,
%%
ld,
%%
ld"
" and 3 last strides
%%
ld
%%
ld,
%%
ld.",
(long int)
%(type_num)
s,
(long int) type_num_
%(name)
s,
(long int) PyArray_NDIM(py_
%(name)
s),
(long int) PyArray_NDIM(py_
%(name)
s) >= 3 ?
PyArray_DIMS(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-3] : -1,
(long int) PyArray_NDIM(py_
%(name)
s) >= 2 ?
PyArray_DIMS(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-2] : -1,
(long int) PyArray_NDIM(py_
%(name)
s) >= 1 ?
PyArray_DIMS(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-1] : -1,
(long int) PyArray_NDIM(py_
%(name)
s) >= 3 ?
PyArray_STRIDES(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-3] : -1,
(long int) PyArray_NDIM(py_
%(name)
s) >= 2 ?
PyArray_STRIDES(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-2] : -1,
(long int) PyArray_NDIM(py_
%(name)
s) >= 1 ?
PyArray_STRIDES(py_
%(name)
s)[PyArray_NDIM(py_
%(name)
s)-1] : -1
);
%(fail)
s
}
"""
%
locals
()
def
c_headers
(
self
):
...
...
@@ -1134,7 +1163,7 @@ class TensorType(Type):
def
c_code_cache_version
(
self
):
scalar_version
=
scal
.
Scalar
(
self
.
dtype
)
.
c_code_cache_version
()
if
scalar_version
:
return
(
7
,)
+
scalar_version
return
(
9
,)
+
scalar_version
else
:
return
()
...
...
@@ -6148,6 +6177,8 @@ class Reshape(Op):
except
Exception
:
raise
ValueError
(
'Cannot reshape input of shape
%
s to shape
%
s'
%
(
x
.
shape
,
shp
))
if
not
out
[
0
]
.
flags
.
aligned
:
raise
RuntimeError
(
"numpy.reshape returned a not aligned tensor."
)
def
connection_pattern
(
self
,
node
):
return
[[
True
],
[
False
]]
...
...
@@ -6214,7 +6245,7 @@ class Reshape(Op):
return
[
tuple
(
oshape
)]
def
c_code_cache_version
(
self
):
return
(
2
,)
return
(
4
,)
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
if
isinstance
(
node
.
inputs
[
0
],
TensorVariable
):
...
...
@@ -6247,6 +6278,10 @@ class Reshape(Op):
"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
)
...
...
@@ -6795,6 +6830,9 @@ class AdvancedSubtensor1(Op):
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
def
__str__
(
self
):
return
self
.
__class__
.
__name__
def
make_node
(
self
,
x
,
ilist
):
x_
=
as_tensor_variable
(
x
)
ilist_
=
as_tensor_variable
(
ilist
)
...
...
theano/tensor/elemwise.py
浏览文件 @
116ad0f3
...
...
@@ -308,7 +308,8 @@ class DimShuffle(Op):
for
i
,
o
in
enumerate
(
self
.
new_order
):
if
o
!=
'x'
:
strides_statements
+=
[(
'strides['
+
str
(
i
)
+
'] = PyArray_STRIDES(
%(basename)
s)['
+
str
(
o
)
+
']'
)]
+
'] = PyArray_DIMS(
%(basename)
s)['
+
str
(
o
)
+
'] == 1? 0 : PyArray_STRIDES(
%(basename)
s)['
+
str
(
o
)
+
']'
)]
else
:
strides_statements
+=
[(
'strides['
+
str
(
i
)
+
'] = 0'
)]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论