PetaVision / OpenPV

PetaVision is a C++ library for designing and deploying large-scale neurally-inspired computational models.
http://petavision.github.io
Eclipse Public License 1.0
40 stars 13 forks source link

Fixed rare issue with sparse matrix dimensions #291

Closed haydn-jones closed 5 years ago

haydn-jones commented 5 years ago

When the sparse matrix was being constructed, I was allowing the CSR matrix constructor to infer the dimensions of the matrix. This is not a problem if every neuron fired. In the event that the last n neurons (if the neurons are viewed as a flattened array) never activated throughout the whole run, the CSR constructor would not know that there should be n more columns in the sparse matrix (because there were no non-zero values in the final n columns indicating that those columns existed). This commit fixes that by always specifying what the dimensions of the sparse matrix should be.

This does not change anything about how the sparse values are being loaded or how the sparse matrix is being constructed, it's only ensuring that the the shape of the matrix is correct.