Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8017a546
提交
8017a546
authored
6月 13, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
only doc the user interface.
上级
c7d12f2d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
56 行增加
和
50 行删除
+56
-50
basic.py
theano/sparse/basic.py
+56
-50
没有找到文件。
theano/sparse/basic.py
浏览文件 @
8017a546
...
@@ -447,23 +447,7 @@ discrete_dtypes = int_dtypes + uint_dtypes
...
@@ -447,23 +447,7 @@ discrete_dtypes = int_dtypes + uint_dtypes
# CONSTRUCTION
# CONSTRUCTION
class
CSMProperties
(
gof
.
Op
):
class
CSMProperties
(
gof
.
Op
):
"""Extract all of .data, .indices, .indptr and .shape.
# See doc in instance of this Op or function after this class definition.
For specific field, `csm_data`, `csm_indices`, `csm_indptr`
and `csm_shape` are provided. Also, `kmap` could be
set through to constructor to specified the parts
of the parameter `data` the op should return.Fancy indexing
with numpy.ndarray should be used for this purpose.
:param csm: Sparse matrix in CSR or CSC format.
:return: (data, indices, indptr, shape), the properties
of `csm`.
:note: The grad implemented is regular, i.e. not structured.
`infer_shape` method is not available for this op.
"""
# NOTE
# NOTE
# We won't implement infer_shape for this op now. This will
# We won't implement infer_shape for this op now. This will
# ask that we implement an GetNNZ op, and this op will keep
# ask that we implement an GetNNZ op, and this op will keep
...
@@ -538,11 +522,18 @@ class CSMProperties(gof.Op):
...
@@ -538,11 +522,18 @@ class CSMProperties(gof.Op):
# don't make this a function or it breaks some optimizations below
# don't make this a function or it breaks some optimizations below
csm_properties
=
CSMProperties
()
csm_properties
=
CSMProperties
()
"""An CSMProperties object instance. It return the fields data,
"""
indices, indptr and shape of the sparse varible. Together they specify
Extract all of .data, .indices, .indptr and .shape field.
completly the the sparse variable when we know its format. Example::
For specific field, `csm_data`, `csm_indices`, `csm_indptr`
and `csm_shape` are provided.
the_data, the_indices, the_indptr, the_shape = csm_properties(a_sparse_var)
:param csm: Sparse matrix in CSR or CSC format.
:return: (data, indices, indptr, shape), the properties of `csm`.
:note: The grad implemented is regular, i.e. not structured.
`infer_shape` method is not available for this op.
"""
"""
...
@@ -575,35 +566,7 @@ def csm_shape(csm):
...
@@ -575,35 +566,7 @@ def csm_shape(csm):
class
CSM
(
gof
.
Op
):
class
CSM
(
gof
.
Op
):
"""Construct a CSC or CSR matrix from the internal
# See doc in instance of this Op or function after this class definition.
representation.
The format for the sparse array can be specified
through the constructor. Also, `kmap` could be
set through to constructor to specified the parts
of the parameter `data` the op should use to construct
the sparse matrix. Fancy indexing with numpy.ndarray
should be used for this purpose.
:param data: One dimensional tensor representing
the data of the sparse to construct.
:param indices: One dimensional tensor of integers
representing the indices of the sparse
matrix to construct.
:param indptr: One dimensional tensor of integers
representing the indice pointer for
the sparse matrix to construct.
:param shape: One dimensional tensor of integers
representing the shape of the sparse
matrix to construct.
:return: A sparse matrix having the properties
specified by the inputs.
:note: The grad method returns a dense vector, so it provides
a regular grad.
"""
kmap
=
None
kmap
=
None
"""Indexing to speficied what part of the data parameter
"""Indexing to speficied what part of the data parameter
should be use to construct the sparse matrix."""
should be use to construct the sparse matrix."""
...
@@ -726,7 +689,50 @@ class CSM(gof.Op):
...
@@ -726,7 +689,50 @@ class CSM(gof.Op):
CSC
=
CSM
(
'csc'
)
CSC
=
CSM
(
'csc'
)
"""Construct a CSC matrix from the internal
representation.
:param data: One dimensional tensor representing
the data of the sparse to construct.
:param indices: One dimensional tensor of integers
representing the indices of the sparse
matrix to construct.
:param indptr: One dimensional tensor of integers
representing the indice pointer for
the sparse matrix to construct.
:param shape: One dimensional tensor of integers
representing the shape of the sparse
matrix to construct.
:return: A sparse matrix having the properties
specified by the inputs.
:note: The grad method returns a dense vector, so it provides
a regular grad.
"""
CSR
=
CSM
(
'csr'
)
CSR
=
CSM
(
'csr'
)
"""Construct a CSR matrix from the internal
representation.
:param data: One dimensional tensor representing
the data of the sparse to construct.
:param indices: One dimensional tensor of integers
representing the indices of the sparse
matrix to construct.
:param indptr: One dimensional tensor of integers
representing the indice pointer for
the sparse matrix to construct.
:param shape: One dimensional tensor of integers
representing the shape of the sparse
matrix to construct.
:return: A sparse matrix having the properties
specified by the inputs.
:note: The grad method returns a dense vector, so it provides
a regular grad.
"""
class
CSMGrad
(
gof
.
op
.
Op
):
class
CSMGrad
(
gof
.
op
.
Op
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论