How to calculate with sparse tensors in TensorFlow?

I want to implement this formula from a DNC implementation in TensorFlow in batch mode.

eqn1
eqn2
eqn3

With batch dense tensors, this is pretty straight forward.

# w [B, N], p [B, N], L [B, N, N], B=batch_size dot_prod = tf.batch_matmul(tf.expand_dims(w, axis=2), tf.expand_dims(p, axis=1)) one_prod = 1 - tf.expand_dims(w, 1) - tf.expand_dims(w, 2) L = one_prod * pre_L + dot_prod 

Is there a way to implement this with sparse tensors? w , p and L are sparse, but TensorFlow is not enough on sparse matrix matte and sparse indexing.

+8
python sparse-matrix tensorflow
source share

No one has answered this question yet.

See related questions:

5116
How to check if a file exists without exceptions?
4268
How to combine two dictionaries in one expression?
3790
How can I safely create a subdirectory?
3474
How to list all the catalog files?
3428
How to sort a dictionary by value?
3235
How to check if a list is empty?
2621
How to create a chain of function decorators?
4
Mass Tensorflow Crushed Batch
0
Convert tensor to SparseTensor for ctc_loss
0
The dense tensor tensor into a sparse binarized hash stunt tensor

All Articles