Skip to content

Commit

Permalink
Update exceptions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanJargon authored Oct 12, 2023
1 parent b4a61c1 commit c3f9a26
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ivy/utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,22 @@ def _handle_exceptions_helper(e, cls):
_inplace_warning_cache = {}


def _handle_inplace_mode(ivy_pack=None):
def _handle_(ivy_pack=None):
if not ivy_pack:
ivy_pack = ivy
current_backend = ivy_pack.current_backend_str()
if (
current_backend != ""
and not _inplace_warning_cache.get(current_backend)
and not ivy_pack.native_inplace_support
and ivy_pack.inplace_mode == "strict"
and ivy_pack. == "lenient"
):
warnings.warn(
f"The current backend: '{current_backend}' does not support "
"inplace updates natively. Ivy would quietly create new arrays when "
"using inplace updates with this backend, leading to memory overhead "
"(same applies for views). If you want to control your memory "
"management, consider doing ivy.set_inplace_mode('strict') which "
"management, consider doing ivy.set_('strict') which "
"should raise an error whenever an inplace update is attempted "
"with this backend."
)
Expand All @@ -403,10 +403,10 @@ def _check_inplace_update_support(x, ensure_in_backend):
if (
ensure_in_backend
or ivy.is_native_array(x)
or (ivy.inplace_mode == "strict" and not is_tf_variable)
or (ivy. == "strict" and not is_tf_variable)
):
raise ivy.utils.exceptions.InplaceUpdateException(
f"{current_backend} does not support inplace updates "
"and ivy cannot support the operation in 'strict' mode\n"
"To enable inplace update, use ivy.set_inplace_mode('lenient')\n"
"To enable inplace update, use ivy.set_('lenient')\n"
)

0 comments on commit c3f9a26

Please sign in to comment.