Skip to content

Commit

Permalink
Add __getstate__ and __setstate__ methods to frontend torch.nn.Module
Browse files Browse the repository at this point in the history
  • Loading branch information
hmahmood24 committed Dec 2, 2023
1 parent 4577f47 commit 0984dae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ivy/functional/frontends/torch/nn/modules/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,11 @@ def __dir__(self):
keys = [key for key in keys if not key[0].isdigit()]

return sorted(keys)

def __getstate__(self):
state = self.__dict__.copy()
state.pop("_compiled_call_impl", None)
return state

def __setstate__(self, state):
self.__dict__.update(state)

0 comments on commit 0984dae

Please sign in to comment.