Reload weights into fc layer after converting to csr_matrix

Viewed 123

I am trying to store weights in a the fc layers in a compressed sparse row format. When I retrieve the weights and convert them to CSR matrix format, its size in memory reduces drastically but when I load it back into caffe my model size remains the same. Basically this is what I'm doing:

temp2 = net.params['ip1'][0].data.shape
sparse_csr1 = sparse.scr_matrix(temp2, shape)
net.params['ip1'][0].data[...] = sparse_csr1
net.save('compressed.caffemodel')

Any suggestions will be appreciated.

2 Answers
Related