提交 8017a546 authored 作者: Frederic's avatar Frederic

only doc the user interface.

上级 c7d12f2d
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论