Would you please give me a simple example to work with tf.raw_ops.DenseToCSRSparseMatrix
. Here is my latest try but It didn’t work:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
ss = tf.constant([[1, 2, 3, 4, 5], [0, 0, 0, 2, 1]], dtype=tf.float32)
indecies = tf.where(tf.not_equal(ss, 0))
b = tf.compat.v1.raw_ops.DenseToCSRSparseMatrix(dense_input=ss, indices=indecies)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
print(sess.run(b))
Bhack
2
I think this is deprecated.
Have you already checked:
And more in general the sparse tensor guide
Thanks for your reply. tf.sparse
only supports the COO format. However, I need the CSR format.
Bhack
4
If you need CSR you can take a look to this tests: