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

Network.__new__'s required params argument breaks torch compatibility #577

Open
elcorto opened this issue Sep 18, 2024 · 0 comments
Open

Comments

@elcorto
Copy link
Member

elcorto commented Sep 18, 2024

When this is a required arg, it breaks torch.save() and torch.load(). But more importantly, it also breaks code that does copy.deepcopy(model).

One option is to make it an optional keyword arg which defaults to None. When torch.load() de-serializes an object, it will first call __new__ to create a class, then create an instance and populate this with data, such that in this case params=None is justified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants