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

Remove dependence on fn #155

Merged
merged 1 commit into from
Apr 11, 2022
Merged

Remove dependence on fn #155

merged 1 commit into from
Apr 11, 2022

Conversation

bryanpkc
Copy link
Contributor

@bryanpkc bryanpkc commented Apr 9, 2022

The Python package fn (https://github.com/kachayev/fn.py) is not actively maintained and OpenTuner only uses it for the _ shortcut for creating lambdas and the Stream class for concatenating iterators. More importantly, fn is incompatible with Python 3.9+ (kachayev/fn.py#86, kachayev/fn.py#91). This patch rewrites the uses of fn in OpenTuner and removes the dependence.

Copy link
Owner

@jansel jansel left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this! There is one minor typo in the comments.

@@ -245,7 +244,7 @@ def hash_config(self, config):

def search_space_size(self):
"""estimate the size of the search space, not precise"""
return reduce(_ * _, [x.search_space_size() for x in self.params])
return reduce(lambda n: n * n, [x.search_space_size() for x in self.params])
Copy link
Owner

Choose a reason for hiding this comment

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

I think this should be:

Suggested change
return reduce(lambda n: n * n, [x.search_space_size() for x in self.params])
return reduce(lambda a, b: a * b, [x.search_space_size() for x in self.params])

Or operator.mul

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed as suggested.

@jansel
Copy link
Owner

jansel commented Apr 11, 2022

Thanks again!

@jansel jansel merged commit 2adb383 into jansel:master Apr 11, 2022
@bryanpkc bryanpkc deleted the remove-fn branch March 12, 2024 12:23
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