Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deal with the "Converting sparse IndexedSlices to a dense Tensor of unknown shape." problem #3

Open
ymabj opened this issue Oct 3, 2019 · 3 comments

Comments

@ymabj
Copy link

ymabj commented Oct 3, 2019

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.

@gasse
Copy link
Member

gasse commented Oct 16, 2019

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

@pg2455
Copy link

pg2455 commented Dec 22, 2019

It can also be the tf.gather in BipartiteGraphConvolution().

@mengyuan-lee
Copy link

Hi there,

I also meet this warning. Could you please let me know if you have any suggestions about this issue?

Best,
Mengyuan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants