You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting below error while trying to convert Dense Matrix to Sparse Matrix.
TypeError: Cannot cast scalar from dtype('O') to dtype('float32') according to the rule 'same_kind'
... vanilla_layer =net.params[layer][0].data
... #print('{}. Layer: {} Type: {} Shape: {} Min weight: {} Max weight: {}'.format(idx,layer,net.layers[idx].type,vanilla_layer.shape,vanilla_layer.min(),vanilla_layer.max()))
... if 'fc6' in layer:
... vanilla_layer_prune,before,after=prune_max_abs_connections_threshold(layer,vanilla_layer,prune_level_FC6)
... np.copyto(net.params[layer][0].data, sparse.csc_matrix(vanilla_layer_prune))
... if 'fc7' in layer:
... vanilla_layer_prune,before,after=prune_max_abs_connections_threshold(layer,vanilla_layer,prune_level_FC7)
... np.copyto(net.params[layer][0].data, sparse.csc_matrix(vanilla_layer_prune))
... if 'fc8' in layer:
... vanilla_layer_prune,before,after=prune_max_abs_connections_threshold(layer,vanilla_layer,prune_level_FC8)
... np.copyto(net.params[layer][0].data, sparse.csc_matrix(vanilla_layer_prune))
...
Traceback (most recent call last):
File "", line 6, in
TypeError: Cannot cast scalar from dtype('O') to dtype('float32') according to the rule 'same_kind'
The text was updated successfully, but these errors were encountered:
s348ankit
changed the title
Getting Error While trying to CONVERT sparse Matrix
Getting Error While trying to convert to sparse Matrix
May 2, 2018
I am getting below error while trying to convert Dense Matrix to Sparse Matrix.
TypeError: Cannot cast scalar from dtype('O') to dtype('float32') according to the rule 'same_kind'
... vanilla_layer =net.params[layer][0].data
... #print('{}. Layer: {} Type: {} Shape: {} Min weight: {} Max weight: {}'.format(idx,layer,net.layers[idx].type,vanilla_layer.shape,vanilla_layer.min(),vanilla_layer.max()))
... if 'fc6' in layer:
... vanilla_layer_prune,before,after=prune_max_abs_connections_threshold(layer,vanilla_layer,prune_level_FC6)
... np.copyto(net.params[layer][0].data, sparse.csc_matrix(vanilla_layer_prune))
... if 'fc7' in layer:
... vanilla_layer_prune,before,after=prune_max_abs_connections_threshold(layer,vanilla_layer,prune_level_FC7)
... np.copyto(net.params[layer][0].data, sparse.csc_matrix(vanilla_layer_prune))
... if 'fc8' in layer:
... vanilla_layer_prune,before,after=prune_max_abs_connections_threshold(layer,vanilla_layer,prune_level_FC8)
... np.copyto(net.params[layer][0].data, sparse.csc_matrix(vanilla_layer_prune))
...
Traceback (most recent call last):
File "", line 6, in
TypeError: Cannot cast scalar from dtype('O') to dtype('float32') according to the rule 'same_kind'
The text was updated successfully, but these errors were encountered: