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

feat: setting sub_backends by default if they are available #25976

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion ivy/utils/backend/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ def set_backend(backend: str, dynamic: bool = False):

if dynamic:
convert_from_numpy_to_target_backend(variable_ids, numpy_objs, devices)

for sub_backend in ivy.available_sub_backends:
ivy.set_sub_backend(sub_backend)
if verbosity.level > 0:
verbosity.cprint(f"backend stack: {backend_stack}")
_handle_inplace_mode()
Expand Down
4 changes: 2 additions & 2 deletions ivy/utils/backend/sub_backend_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ def _unset_sub_backend_from_ivy(
def clear_sub_backends():
if ivy.current_sub_backends:
ivy.__dict__.update(original_backend_dict)
ivy.current_sub_backends = []
ivy.current_sub_backends.clear()


# This is only used in set_backend in handler.py
def _clear_current_sub_backends():
global original_backend_dict
original_backend_dict = None
if ivy.current_sub_backends:
ivy.current_sub_backends = []
ivy.current_sub_backends.clear()


def find_available_sub_backends(sub_backends_loc):
Expand Down
Loading