Skip to content

Commit

Permalink
feat: set sub_backends by default if they are available (ivy-llc#25976)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShreyanshBardia authored and iababio committed Sep 27, 2023
1 parent a38e634 commit 89481e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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

0 comments on commit 89481e7

Please sign in to comment.