-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[jit] guard against inheritance on torchscript classes #28407
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
Conversation
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags:
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags:
… classes" Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
zdevito
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, small phrasing comment.
torch/jit/__init__.py
Outdated
| raise RuntimeError("TorchScript classes must be new-style classes. " | ||
| "Please inherit from 'object'") | ||
| if len(obj.mro()) > 2: | ||
| raise RuntimeError("TorchScript classes does not support inheritance or any polymorphism strategy yet. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"or any polymorphism strategy" is not correct. Interfaces are a form of polymorphism. The first part of the message is fine.
torch/jit/__init__.py
Outdated
| "Please inherit from 'object'") | ||
| if len(obj.mro()) > 2: | ||
| raise RuntimeError("TorchScript classes does not support inheritance or any polymorphism strategy yet. " | ||
| "Please directly inherit from 'object'. File a issue if you want this. ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep 'File an issue' for bugs only. It implies implementing this would be easy when it is in face very difficult, which is why we haven't implemented it.
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Given that we do not have support for inheitance or any polymorphism strategy yet, we should guard against user from using it until we get the full support so that user won't confuse by the weird behaviors. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D18284310](https://our.internmc.facebook.com/intern/diff/D18284310) [ghstack-poisoned]
|
This pull request has been merged in 1e90404. |
Stack from ghstack:
Summary:
Given that we do not have support for inheitance or any polymorphism
strategy yet, we should guard against user from using it until we get
the full support so that user won't confuse by the weird behaviors.
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D18284310