Comments (2)
@mingyr Hi, thanks for your detailed comment.
I've looked into this before and unfortunately there are no publicly exposed APIs from TF which allow us to have more control over this. I would like to be able to capture the surrounding device context when constructing a module, as your middle example shows. However unlike the various kinds of scopes, tf.device
doesn't return anything you can hang onto and reenter, eg:
with tf.variable_scope('some_name') as scope:
print(scope) # Prints a VariableScope object we can query, reenter, etc
with tf.device('/cpu:0') as device_information:
print(device_information) # prints `None`
Without being able to capture the context, we cannot respect device placement directives around where we construct modules. If you read the TF source you see that this works by accessing various private members of the Graph
object and others, and it would be a huge maintenance burden for us to start relying on these private APIs.
We've had some conversations with the TF team about creating an external more advanced use of device placement (and other things(), and those discussions are ongoing. I hope to have some improvement in this area in the public version soon.
It's very useful to hear from users about the pain points of the library, so once again thankyou.
from sonnet.
@malcolmreynolds I am sincerely appreciating the detailed explanation and fully understanding the situation. The important thing is not we invent something perfect but we invent something based on which we can advance our daily job. I am glad that Sonnet is such a library which helps me a great deal. Thanks for the contribution made by you engineers at Deepmind which benefits the deep learning community a lot.
from sonnet.
Related Issues (20)
- how to remove model from gpu memory? HOT 1
- Understanding how to use mixed precision training HOT 2
- Conv2D initialize error in tf function
- Typo HOT 1
- this portion of attention code looks incorrect
- Cannot install sonnet on mac m1 HOT 5
- Decaying learning rate HOT 1
- Can you explain the logic of updated_ema_cluster_size in VectorQuantizerEMA?
- Convert a Sonnet model to a Keras model HOT 1
- (Maybe) in-consistency between VQ-VAE paper and its implementation. HOT 2
- Regarding LearningRateSchedule for ADAM optimizer HOT 2
- Learning rate and optimizer used for the VQ-VAE-2 paper HOT 2
- I have a question about the perplexity term (in the VQ-VAE). HOT 2
- Issues using Sonnet HOT 3
- How to save the checkpoint for self-defined model?
- TensorArray Not Used on line 71 of sgd_test.py HOT 2
- Is there a stereotypical way to visualize the network strucuture when using Sonnet? HOT 1
- sonnet abstract module in tensorflow2 HOT 10
- Laplace smoothing for EMA codebook update
- Basic import fails on Colab: cannot import name 'context' from 'tensorflow.python' HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sonnet.