Define __slots__ for small classes#40783
Merged
tensorflow-copybara merged 2 commits intotensorflow:masterfrom Jul 9, 2020
Merged
Define __slots__ for small classes#40783tensorflow-copybara merged 2 commits intotensorflow:masterfrom
tensorflow-copybara merged 2 commits intotensorflow:masterfrom
Conversation
alextp
previously approved these changes
Jun 25, 2020
alextp
previously approved these changes
Jun 25, 2020
alextp
previously approved these changes
Jun 25, 2020
Contributor
Author
|
Sorry about the failing tests (it's a bit challenging to run all test locally without a proper bazel cache) af273bc should fix it. |
alextp
previously approved these changes
Jun 25, 2020
alextp
previously approved these changes
Jun 26, 2020
Contributor
Author
|
aa41fec should fix the last CI breakage, sorry about that. |
alextp
approved these changes
Jun 29, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TensorFlow has many small classes that are used internally as wrappers or containers. Frequently used objects can benefit from defining
__slots__.From the Python docs:
This PR explicitely defines
__slots__for a non exhaustive list of classes that have very few attributes, tend not to be inherited from and don't use dynamic assignment of new variables.