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

convenience wrapper of torch.set_num_threads #1001

Merged
merged 3 commits into from
Mar 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scvi/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def seed(self) -> int:
"""Random seed for torch and numpy."""
return self._seed

def set_num_threads(self, num: int):
"""Sets number of threads torch will use to `num`."""
torch.set_num_threads(num)

Copy link
Member

Choose a reason for hiding this comment

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

num_threads needs to be a property with a setter, the setter runs num threads, you can default the property to return None?

@seed.setter
def seed(self, seed: int):
"""Random seed for torch and numpy."""
Expand Down