BVLC/caffe — pull request #937 by alemagnani (2014-08-16 05:49:15+00:00)
Title: Sparse Data Support

This adds some basic support for sparse data in CSR format. The main thing is a SparseBlob to store the sparse data and an extension to InnerProduct that handles both dense and sparse depending on what is presented at the input. A new data layer is added to read data from LevelDB.
Some more details:
* subclass of Blob that handles matrices in CSR format (SparseBlob)
* extension of InnerProductLayer to deal with a sparse blob as input
* a new data layer (DataLayerSparseInput) that reads for LevelDB sparse vector and creates SparseBlob
* support for CuSparse
* new sparse math operations on both GPU and CPU
* small change to Syncedmem to make it possible to own/not own GPU data.

* new Proto object SparseDatum to store sparse vectors.
* changed the way Net creates Blobs to support sparse blobs. Basically the bottom layer gets to decide what Blob to create. This way the DataLayerSparseInput produces SparseBlobs (see the new method in layer_factory.cpp). There could be other ways to achieve the same results.
* exstensive test got the new math function and the new layer
* 2 different implementations of GPU sparse kernels (one is commented out). This is because I found out that CUSparse has very poor performance at least in the way I used it.