提交 a759089a authored 作者: AdeB's avatar AdeB 提交者: Xavier Bouthillier

Add Sphinx documentation and image to illustrate sparse block dot

上级 5b604a49
.. _libdoc_blocksparse:
===================================================================
:mod:`sandbox.blocksparse` -- Block sparse dot operations (gemv and outer)
===================================================================
.. module:: sandbox.blocksparse
:platform: Unix, Windows
:synopsis: Block sparse dot
.. moduleauthor:: LISA
API
===
.. automodule:: theano.sandbox.blocksparse
:members:
...@@ -17,7 +17,9 @@ class SparseBlockGemv(Op): ...@@ -17,7 +17,9 @@ class SparseBlockGemv(Op):
o[b, j, :] += numpy.dot(h[b, i], W[iIdx[b, i], oIdx[b, j]]) o[b, j, :] += numpy.dot(h[b, i], W[iIdx[b, i], oIdx[b, j]])
where b, h, W, o iIdx, oIdx are defined in the docstring of make_node. where b, h, W, o iIdx, oIdx are defined in the docstring of make_node.
.. image:: ../../images/blocksparse.png .. image:: ../../images/blocksparse.png
:scale: 50 %
""" """
registered_opts = [] registered_opts = []
...@@ -119,7 +121,6 @@ class SparseBlockOuter(Op): ...@@ -119,7 +121,6 @@ class SparseBlockOuter(Op):
def make_node(self, o, x, y, xIdx, yIdx, alpha=None): def make_node(self, o, x, y, xIdx, yIdx, alpha=None):
""" """
Compute the dot product of the specified pieces of vectors Compute the dot product of the specified pieces of vectors
and matrices. and matrices.
......
...@@ -303,7 +303,8 @@ class BlockSparse_Gemv_and_Outer(unittest.TestCase): ...@@ -303,7 +303,8 @@ class BlockSparse_Gemv_and_Outer(unittest.TestCase):
out = self.outer_op(o, x, y, xIdx, yIdx) out = self.outer_op(o, x, y, xIdx, yIdx)
f = theano.function([o, x, y, xIdx, yIdx], out, on_unused_input="warn") f = theano.function([o, x, y, xIdx, yIdx], out,
on_unused_input="warn")
o_val, x_val, y_val, xIdx_val, yIdx_val = \ o_val, x_val, y_val, xIdx_val, yIdx_val = \
BlockSparse_Gemv_and_Outer.outer_data() BlockSparse_Gemv_and_Outer.outer_data()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论