learn2branch
learn2branch copied to clipboard
How to deal with the "Converting sparse IndexedSlices to a dense Tensor of unknown shape." problem
Hi,
When I am running the codes in 03_train_gcnn.py there is a problem as following:
/root/miniconda3/envs/myenv/lib/python3.7/site-packages/tensorflow/python/ops/gradients_util.py:93: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory. "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
I think this problem may happen due to the tf.gather() function you use in line 150.
logits = model(batched_states)
logits = tf.expand_dims(tf.gather(tf.squeeze(logits, 0), cands), 0) # filter candidate variables
logits = model.pad_output(logits, n_cands.numpy()) # apply padding now
loss = tf.losses.sparse_softmax_cross_entropy(labels=actions, logits=logits)
I wonder if there is any substitute for tf.gather() to deal with this problem. Thank you.
Hi,
I also encounter such a warning sometimes, although the code seems to run fine. I do not have much time to investigate the issue right now. If you find a workaround please let us know !
Best, Maxime
It can also be the tf.gather in BipartiteGraphConvolution().
Hi there,
I also meet this warning. Could you please let me know if you have any suggestions about this issue?
Best, Mengyuan