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

Optimize scaler #99

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Optimize scaler #99

wants to merge 2 commits into from

Conversation

lufre1
Copy link
Contributor

@lufre1 lufre1 commented Feb 14, 2025

@constantinpape
i added the changes directly into the _scaler so i didn't have to adapt all the inference scripts

@@ -33,7 +33,14 @@

class _Scaler:
def __init__(self, scale, verbose):
self.scale = scale
if isinstance(scale, (int, float)): # single number
is_one = scale in (1, 1.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's usually better to do np.isclose for this.

if isinstance(scale, (int, float)): # single number
is_one = scale in (1, 1.0)
else: # list
is_one = all(s in (1, 1.0) for s in scale)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use np.allclose

@constantinpape
Copy link
Contributor

See the comments to improve this @lufre1

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