Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6f3970eb
提交
6f3970eb
authored
7月 17, 2015
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3148 from harlouci/props_sparse
Props sparse
上级
98229fd2
58b0847e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
72 行删除
+11
-72
basic.py
theano/sparse/basic.py
+0
-0
opt.py
theano/sparse/opt.py
+11
-72
没有找到文件。
theano/sparse/basic.py
浏览文件 @
6f3970eb
差异被折叠。
点击展开。
theano/sparse/opt.py
浏览文件 @
6f3970eb
...
...
@@ -65,6 +65,8 @@ class AddSD_ccode(gof.op.Op):
:note: The grad implemented is structured on `x`.
"""
__props__
=
(
"format"
,
"inplace"
)
def
__init__
(
self
,
format
,
inplace
=
False
,
*
args
,
**
kwargs
):
gof
.
Op
.
__init__
(
self
,
*
args
,
**
kwargs
)
# Should we do inplace addition or not ?
...
...
@@ -73,14 +75,6 @@ class AddSD_ccode(gof.op.Op):
if
self
.
inplace
:
self
.
destroy_map
=
{
0
:
[
3
]}
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
)
and
self
.
inplace
==
other
.
inplace
and
self
.
format
==
other
.
format
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
^
hash
(
self
.
inplace
)
^
hash
(
self
.
format
)
def
__str__
(
self
):
inp
=
''
if
self
.
inplace
:
...
...
@@ -224,15 +218,7 @@ class StructuredDotCSC(gof.Op):
:note: The grad implemented is structured.
:note: This op is used as an optimization for StructuredDot.
"""
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
__str__
(
self
):
return
self
.
__class__
.
__name__
__props__
=
()
def
make_node
(
self
,
a_val
,
a_ind
,
a_ptr
,
a_nrows
,
b
):
dtype_out
=
scalar
.
upcast
(
a_val
.
type
.
dtype
,
b
.
type
.
dtype
)
...
...
@@ -418,15 +404,7 @@ class StructuredDotCSR(gof.Op):
:note: The grad implemented is structured.
:note: This op is used as an optimization for StructuredDot.
"""
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
__str__
(
self
):
return
self
.
__class__
.
__name__
__props__
=
()
def
make_node
(
self
,
a_val
,
a_ind
,
a_ptr
,
b
):
self
.
dtype_out
=
scalar
.
upcast
(
a_val
.
type
.
dtype
,
b
.
type
.
dtype
)
...
...
@@ -604,6 +582,7 @@ class UsmmCscDense(gof.Op):
:note: Optimized version os Usmm when `x` is in csc format and
`y` is dense.
"""
__props__
=
(
"inplace"
,)
def
__init__
(
self
,
inplace
):
self
.
inplace
=
inplace
...
...
@@ -616,12 +595,6 @@ class UsmmCscDense(gof.Op):
else
:
return
'UsmmCscDense{no_inplace}'
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
and
self
.
inplace
==
other
.
inplace
def
__hash__
(
self
):
return
hash
(
type
(
self
))
^
self
.
inplace
def
make_node
(
self
,
alpha
,
x_val
,
x_ind
,
x_ptr
,
x_nrows
,
y
,
z
):
alpha
=
tensor
.
as_tensor_variable
(
alpha
)
x_val
=
tensor
.
as_tensor_variable
(
x_val
)
...
...
@@ -890,14 +863,8 @@ register_specialize(local_usmm_csx, 'cxx_only')
class
CSMGradC
(
gof
.
Op
):
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
__str__
(
self
):
return
self
.
__class__
.
__name__
__props__
=
()
def
make_node
(
self
,
a_val
,
a_ind
,
a_ptr
,
a_dim
,
b_val
,
b_ind
,
b_ptr
,
b_dim
):
...
...
@@ -1045,12 +1012,7 @@ class MulSDCSC(gof.Op):
cannot be a complex type.
:note: This op is used as an optimization of mul_s_d.
"""
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
def
__hash__
(
self
):
return
hash
(
type
(
self
))
__props__
=
()
def
make_node
(
self
,
a_data
,
a_indices
,
a_indptr
,
b
):
assert
b
.
type
.
ndim
==
2
...
...
@@ -1162,12 +1124,7 @@ class MulSDCSR(gof.Op):
cannot be a complex type.
:note: This op is used as an optimization of mul_s_d.
"""
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
def
__hash__
(
self
):
return
hash
(
type
(
self
))
__props__
=
()
def
make_node
(
self
,
a_data
,
a_indices
,
a_indptr
,
b
):
assert
b
.
type
.
ndim
==
2
...
...
@@ -1321,12 +1278,7 @@ class MulSVCSR(gof.Op):
cannot be a complex type.
:note: This op is used as an optimization of MulSV.
"""
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
def
__hash__
(
self
):
return
hash
(
type
(
self
))
__props__
=
()
def
make_node
(
self
,
a_data
,
a_indices
,
a_indptr
,
b
):
assert
b
.
type
.
ndim
==
1
...
...
@@ -1464,12 +1416,7 @@ class StructuredAddSVCSR(gof.Op):
format.
:note: This op is used as an optimization for StructuredAddSV.
"""
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
def
__hash__
(
self
):
return
hash
(
type
(
self
))
__props__
=
()
def
make_node
(
self
,
a_data
,
a_indices
,
a_indptr
,
b
):
b
=
tensor
.
as_tensor_variable
(
b
)
...
...
@@ -1638,15 +1585,7 @@ class SamplingDotCSR(gof.Op):
allow mixed dtype.
:note: This op is used as an optimization for SamplingDot.
"""
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
__str__
(
self
):
return
'SamplingDot{Csr}'
__props__
=
()
def
make_node
(
self
,
x
,
y
,
p_data
,
p_ind
,
p_ptr
,
p_ncols
):
x
=
tensor
.
as_tensor_variable
(
x
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论