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

Cosmetic improvements to code #215

Merged
merged 3 commits into from
Aug 25, 2020
Merged

Cosmetic improvements to code #215

merged 3 commits into from
Aug 25, 2020

Conversation

chrisyeh96
Copy link
Contributor

@chrisyeh96 chrisyeh96 commented Jul 28, 2020

  1. Use PyTorch's own nn.Identity() function, available since PyTorch v1.1.0, instead of a duplicate implementation.

2) Update minimum Python version to 3.6 because of the use of f-strings. (see discussion below)

  1. Remove excess whitespace

@@ -134,7 +133,7 @@ def drop_connect(inputs, p, training):
Returns:
output: Output after drop connection.
"""
assert p >= 0 and p <= 1, 'p must be in range of [0,1]'
assert 0 <= p <= 1, 'p must be in range of [0,1]'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Python has supported chained comparisons since at least version Python 3.0

@lukemelas
Copy link
Owner

lukemelas commented Jul 29, 2020

Thanks for the PR! I'll definitely merge the cosmetic changes and I think the use of nn.Identity. I originally held off on that and f-strings in order to make it compatible with more systems.

I love f-strings, but I think I'll likely keep the .format() syntax for now to make sure it's compatible with 3.5. The main PyTorch repo only just dropped 3.5 support in the release today (1.6.0) so I think it would be good to keep supporting 3.5 for the time being.

1) Use PyTorch's own nn.Identity() function.

2) Update minimum Python version to 3.6 because of the use of f-strings.

3) Remove excess whitespace
@chrisyeh96
Copy link
Contributor Author

@lukemelas There were a few places in the repo where you were already using f-strings, which is why I thought to continue using them. However, I agree that supporting Python 3.5 is also good to do for now. I went ahead and replaced all of the instances of f-strings with .format() so everything should be Python 3.5 compliant now.

@lukemelas lukemelas merged commit f543b74 into lukemelas:master Aug 25, 2020
@chrisyeh96 chrisyeh96 deleted the linting branch August 25, 2020 19:35
ulosc pushed a commit to ulosc/efficientnet that referenced this pull request Aug 18, 2021
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