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

Standardize keras symbol imports #1187

Closed
jbischof opened this issue Jan 7, 2023 · 4 comments
Closed

Standardize keras symbol imports #1187

jbischof opened this issue Jan 7, 2023 · 4 comments

Comments

@jbischof
Copy link
Contributor

jbischof commented Jan 7, 2023

The new standard for importing Keras is from tensorflow import keras. Most of the guides and examples on keras.io do this, but our symbol imports are all over the place including:

keras.foo()
tf.keras.foo()
tensorflow.keras.foo()

Let's standardize on keras.foo(). Like #1181, we can directly modify both generated and original files with a simple find-and-replace since it would be too much work to regenerate everything. The main caveat is checking that each script has the topline import from tensorflow import keras, which it should!

@mattdangerw
Copy link
Member

We made a deliberate call to always import keras and keras_nlp as top-levels for examples using KerasNLP. https://github.com/keras-team/keras-nlp/blob/master/STYLE_GUIDE.md#import-keras-and-keras_nlp-as-top-level-objects

I'm not sure if we want that style universally, but for domain packages the style is useful.

@sachinprasadhs
Copy link
Collaborator

Since we have direct import of Keras now, do you find this request still relevant now?

@jbischof
Copy link
Contributor Author

Nope, thank you!

Copy link

Are you satisfied with the resolution of your issue?
Yes
No

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

No branches or pull requests

3 participants