Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f707ea95
提交
f707ea95
authored
2月 07, 2012
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #427 from nouiz/fix_reduce
Fix reduce
上级
29d3f9e0
043bebe1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
2 行删除
+22
-2
elemwise.py
theano/tensor/elemwise.py
+22
-2
没有找到文件。
theano/tensor/elemwise.py
浏览文件 @
f707ea95
...
@@ -1026,6 +1026,9 @@ class CAReduce(Op):
...
@@ -1026,6 +1026,9 @@ class CAReduce(Op):
self
.
axis
.
sort
()
self
.
axis
.
sort
()
self
.
axis
=
tuple
(
self
.
axis
)
self
.
axis
=
tuple
(
self
.
axis
)
self
.
set_ufunc
(
scalar_op
)
def
set_ufunc
(
self
,
scalar_op
):
# This is probably a speed up of the implementation
# This is probably a speed up of the implementation
if
isinstance
(
scalar_op
,
theano
.
scalar
.
basic
.
Add
):
if
isinstance
(
scalar_op
,
theano
.
scalar
.
basic
.
Add
):
self
.
ufunc
=
numpy
.
add
self
.
ufunc
=
numpy
.
add
...
@@ -1078,12 +1081,12 @@ class CAReduce(Op):
...
@@ -1078,12 +1081,12 @@ class CAReduce(Op):
def
__getstate__
(
self
):
def
__getstate__
(
self
):
d
=
copy
(
self
.
__dict__
)
d
=
copy
(
self
.
__dict__
)
d
.
pop
(
'ufunc'
)
d
.
pop
(
'ufunc'
,
None
)
return
d
return
d
def
__setstate__
(
self
,
d
):
def
__setstate__
(
self
,
d
):
self
.
__dict__
.
update
(
d
)
self
.
__dict__
.
update
(
d
)
self
.
ufunc
=
numpy
.
frompyfunc
(
self
.
scalar_op
.
impl
,
2
,
1
)
self
.
set_ufunc
(
self
.
scalar_op
)
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
and
self
.
scalar_op
==
other
.
scalar_op
and
self
.
axis
==
other
.
axis
return
type
(
self
)
==
type
(
other
)
and
self
.
scalar_op
==
other
.
scalar_op
and
self
.
axis
==
other
.
axis
...
@@ -1357,8 +1360,25 @@ class CAReduceDtype(CAReduce):
...
@@ -1357,8 +1360,25 @@ class CAReduceDtype(CAReduce):
def
__hash__
(
self
):
def
__hash__
(
self
):
return
CAReduce
.
__hash__
(
self
)
^
hash
(
self
.
dtype
)
return
CAReduce
.
__hash__
(
self
)
^
hash
(
self
.
dtype
)
def
__setstate__
(
self
,
d
):
self
.
__dict__
.
update
(
d
)
if
not
hasattr
(
self
,
"dtype"
):
# This is needed as old pickled will crash otherwise.
# We need to keep the old dtype behavior as the op
# could be in an apply node with a specified dtype.
self
.
dtype
=
"OLD"
def
_output_dtype
(
self
,
idtype
):
def
_output_dtype
(
self
,
idtype
):
dtype
=
self
.
dtype
dtype
=
self
.
dtype
if
dtype
==
"OLD"
:
return
dict
(
int8
=
'int32'
,
int16
=
'int32'
,
int32
=
'int64'
,
uint8
=
'uint32'
,
uint16
=
'uint32'
,
uint32
=
'uint64'
,
)
.
get
(
idtype
,
idtype
)
if
dtype
is
None
:
if
dtype
is
None
:
# If input has a discrete dtype, upcast it to 64
# If input has a discrete dtype, upcast it to 64
return
dict
(
return
dict
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论