Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b547aa90
提交
b547aa90
authored
4月 24, 2017
作者:
Frédéric Bastien
提交者:
GitHub
4月 24, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5885 from AndreiCostinescu/patch-1
Corrected some comments and code formatting
上级
3df1e8a3
c57ea653
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
11 行删除
+11
-11
elemwise.py
theano/tensor/elemwise.py
+11
-11
没有找到文件。
theano/tensor/elemwise.py
浏览文件 @
b547aa90
...
@@ -1353,8 +1353,8 @@ class CAReduce(Op):
...
@@ -1353,8 +1353,8 @@ class CAReduce(Op):
axis2
.
append
(
a
)
axis2
.
append
(
a
)
assert
len
(
axis
)
==
len
(
axis2
)
assert
len
(
axis
)
==
len
(
axis2
)
axis
=
tuple
(
axis2
)
axis
=
tuple
(
axis2
)
# We can't call self.__class__() as there is class that
# We can't call self.__class__() as there is
a
class that
# inherit
from CAReduce that do
n't have the same signature
# inherit
s from CAReduce that does
n't have the same signature
op
=
copy
(
self
)
op
=
copy
(
self
)
op
.
set_ufunc
(
op
.
scalar_op
)
op
.
set_ufunc
(
op
.
scalar_op
)
op
.
axis
=
axis
op
.
axis
=
axis
...
@@ -1398,7 +1398,7 @@ class CAReduce(Op):
...
@@ -1398,7 +1398,7 @@ class CAReduce(Op):
if
to_reduce
:
if
to_reduce
:
for
dimension
in
to_reduce
:
for
dimension
in
to_reduce
:
# If it's a zero-size array, use scalar_op.identity
# If it's a zero-size
d
array, use scalar_op.identity
# if available
# if available
if
variable
.
shape
[
dimension
]
==
0
:
if
variable
.
shape
[
dimension
]
==
0
:
if
hasattr
(
self
.
scalar_op
,
'identity'
):
if
hasattr
(
self
.
scalar_op
,
'identity'
):
...
@@ -1553,14 +1553,14 @@ class CAReduce(Op):
...
@@ -1553,14 +1553,14 @@ class CAReduce(Op):
pattern_
=
str
(
pattern
)[
1
:
-
1
]
pattern_
=
str
(
pattern
)[
1
:
-
1
]
decl
+=
"""int tosum[]={
%(pattern_)
s};"""
%
locals
()
decl
+=
"""int tosum[]={
%(pattern_)
s};"""
%
locals
()
alloc
+=
"""
alloc
+=
"""
for(int i=0;i<PyArray_NDIM(
%(iname)
s);i++){
for(int i=0;i<PyArray_NDIM(
%(iname)
s);i++){
if(PyArray_DIMS(
%(iname)
s)[i]==0 && tosum[i]){
if(PyArray_DIMS(
%(iname)
s)[i]==0 && tosum[i]){
PyErr_Format(PyExc_ValueError,
PyErr_Format(PyExc_ValueError,
"Input of CAReduce{
%(scal_name)
s} has zero-size on axis
%%
d",i);
"Input of CAReduce{
%(scal_name)
s} has zero-size on axis
%%
d",i);
%(fail)
s;
%(fail)
s;
}
}
}
}
"""
%
locals
()
"""
%
locals
()
else
:
else
:
raise
TypeError
(
raise
TypeError
(
"The CAReduce.scalar_op must have an identity field."
)
"The CAReduce.scalar_op must have an identity field."
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论