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

Dataset in GPU memory: updating specific elements in existing tf.Variable #2756

Closed
tomrunia opened this issue Jun 9, 2016 · 2 comments
Closed
Labels
stat:awaiting response Status - Awaiting response from author

Comments

@tomrunia
Copy link

tomrunia commented Jun 9, 2016

My machine has a Titan X card so I would like to use the memory as efficient as possible to avoid expensive data transfer between the CPU and GPU. Therefore, I want to have as many images as possible (let's say 5 GB) on the GPU memory inside a tf.Variable or tf.constant. However, I also want to update these data tensors after a number of iterations (e.g. a replay memory). For training, I then only need to send sample indices to the GPU and use tf.slice to generate a training batch.

My question is what the correct way is to update specific elements in an existing tf.Variable? I already found methods using tf.scatter_update and tf.slice:

http://stackoverflow.com/questions/34685947/adjust-single-value-within-tensor-tensorflow
http://stackoverflow.com/questions/37593960/set-k-largest-elements-of-a-tensor-to-zero-in-tensorflow

But these methods seem cumbersome and tricky. Are there better ways of updating existing variables?

@girving
Copy link
Contributor

girving commented Jun 9, 2016

Some of this is covered #206. For single variables and unordered sets of elements tf.scatter_update is the right thing, and #206 proposes tf.assign_slice_* which cover what you want. Our hope is to make most of these available with something like x[i].assign(...), but there are a few steps before we get there.

If your satisfied with #206 I'll close as duplicate, but let me know if not!

@girving girving added the stat:awaiting response Status - Awaiting response from author label Jun 9, 2016
@tomrunia
Copy link
Author

Hi Geoffrey, thanks for your reply. I am satisfied with the conversation and proposed solutions in #206. You can close this one. Hopefully the assign operations will arrive soon!

@girving girving closed this as completed Jun 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author
Projects
None yet
Development

No branches or pull requests

2 participants