Skip to content

Commit

Permalink
add __reduce__ method to IvyGlobalProps (#28234)
Browse files Browse the repository at this point in the history
Co-authored-by: ivy-branch <ivy.branch@lets-unify.ai>
  • Loading branch information
Dsantra92 and ivy-branch authored Feb 10, 2024
1 parent 568de6b commit 2bff09c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ivy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numpy as np
import sys
import inspect
import importlib
import os
from collections.abc import Sequence

Expand Down Expand Up @@ -1540,6 +1541,14 @@ def __setattr__(self, name, value, internal=False):
)
self.__dict__[name] = value

def __reduce__(self):
def _get_module_and_replace_name(module_name: str):
module = importlib.import_module(module_name)
module.__class__ = self.__class__
return module

return (_get_module_and_replace_name, (self.__name__,))


if (
"ivy" in sys.modules
Expand Down

0 comments on commit 2bff09c

Please sign in to comment.