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

[Refactors] If-statements #57

Open
Anselmoo opened this issue Feb 1, 2022 · 0 comments
Open

[Refactors] If-statements #57

Anselmoo opened this issue Feb 1, 2022 · 0 comments

Comments

@Anselmoo
Copy link

Anselmoo commented Feb 1, 2022

Some if-statements can be simplified according to https://www.python.org/dev/peps/pep-0008/, as shown below.

else:
if data[key].dtype not in TPU_SUPPORTED_DTYPES:
tf.logging.warning(
"Removing key '{}' from data dict because its dtype {} is not in "
" the supported dtypes: {}".format(key, data[key].dtype,
TPU_SUPPORTED_DTYPES))
data = _get_delete_field(key)(data)
return data

if self._dataset_info:
if self._dataset_info.appearing_classes:
num_classes = self._dataset_info.num_classes
all_classes = set(range(num_classes))
appearing_classes = set(self._dataset_info.appearing_classes)
self._classes_to_ignore = all_classes.difference(appearing_classes)

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

No branches or pull requests

1 participant