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

Change the order of importing keras #1596

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

james77777778
Copy link
Collaborator

This should fix the issue (after #1593) with type annotations for modern editors such as vscode.

Before After
before after

@SamanehSaadat
Copy link
Member

Hi @james77777778!

Thanks for catching this and thanks for sending the fix!
I'm curious to understand why changing the order in the if/else fixes the issue.
Also, do you know which docstring it's showing on the vscode? Is it Keras 2 docstring or Keras 3?

Copy link
Member

@SamanehSaadat SamanehSaadat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@SamanehSaadat SamanehSaadat merged commit c9e7e3f into keras-team:master Apr 24, 2024
7 checks passed
SamanehSaadat pushed a commit that referenced this pull request Apr 24, 2024
@james77777778
Copy link
Collaborator Author

@SamanehSaadat

I'm curious to understand why changing the order in the if/else fixes the issue.

I'm not an expert on Pylance, but it seems to always choose the else condition when it fails to recognize the condition.
Same observation applies to Keras library. For example, keras.ops.* will always be directed to keras.src.backend.numpy.*.

Also, do you know which docstring it's showing on the vscode? Is it Keras 2 docstring or Keras 3?

It will be Keras 3 since it is placed in else condition.

@james77777778 james77777778 deleted the enhance-import branch April 25, 2024 01:11
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

Successfully merging this pull request may close these issues.

2 participants