-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Save PyTorch frontend state in object #7023
Conversation
I've tried to keep this "somewhat minimal", so I didn't move around all the helper functions. |
Thanks for working on this. I have three questions:
cc @siju-samuel We will be doing big refactoring of pytorch frontend. |
Right now CI is having an issue, please retrigger after #7025 is merged. |
Also, now that we are encapsulating each converter inside a class, I think it is ok to remove underscore |
Thank you for looking at this.
|
|
38a66a1
to
4643967
Compare
For 1. I can make all methods nonstatic. I wouldn't know how to reasonably make all methods static. |
Maybe I'm missing something, I'm just wondering why, for example, tvm/python/tvm/relay/frontend/pytorch.py Line 610 in 4643967
linspace just below is static? By "all" I just meant all op converters (not all methods), I don't see why we cannot make some of op converters static?
|
So the object holds some state such as the |
Ah I see, thanks. |
4643967
to
e0df5b1
Compare
So what I didn't do yet is move all utility functions that use the state (default_dtype and prelude) into the class. We could add that or defer. |
Yeah we can definitely register quantized ops converter early. I don't think there is a deep reason it is registered late in the current implementation. |
What do you think, add more now or do it later? If the current state is good for you, I'd have a mild tendency to stop here and to a separate PR for further things (including exploiting the new stateful converter for reworking speedup patch I look forward to a lot). |
Yes I'll merge this as it is after CI is cleared. We can do other stuff later. |
While the functional approach is pretty neat, we ended up having global state (default frontend, dtype) and it'll be more soon (caching of inferred types, see apache#6900). To not have to pass around the state, this moves the op conversion into a class with instances having the state.
e0df5b1
to
5a590a3
Compare
At last all the CI is happy. Sorry this took so long. |
Thanks @t-vi |
Thank you for reviewing & merging, @masahi ! |
While the functional approach is pretty neat, we ended up having global state (default frontend, dtype) and it'll be more soon (caching of inferred types, see apache#6900). To not have to pass around the state, this moves the op conversion into a class with instances having the state.
While the functional approach is pretty neat, we ended up having global state (default frontend, dtype) and it'll be more soon (caching of inferred types, see apache#6900). To not have to pass around the state, this moves the op conversion into a class with instances having the state.
While the functional approach is pretty neat, we ended up having global state (default frontend, dtype) and it'll be more soon (caching of inferred types, see apache#6900). To not have to pass around the state, this moves the op conversion into a class with instances having the state.
While the functional approach is pretty neat, we ended up having global state (default frontend, dtype) and it'll be more soon (caching of inferred types, see #6900). To not have to pass around the state, this moves the op conversion into a class with instances having the state.