Revamp "sample" function to be a __call__ method #32
Replies: 3 comments 3 replies
-
This seems great👍 |
Beta Was this translation helpful? Give feedback.
3 replies
-
Added a new branch |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ok, the new interface has been merged, all the tests have passed, looks good! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This would be a major refactor of the interface. The idea is that instead of calling:
model.sample(image)
one would simply call:
model(image)
This is somewhat cleaner, but also makes it clearer what the core purpose of the model is for, sampling images. Internally there could still be a sample method but it would be more low level/functional. For those trying to use AutoProf for a more specialized workflow it may be helpful to have a clear way to call lower level functions as well. The inspiration comes from pytorch nn.Module which has users implement a
forward
function however the modules themselves are called by__call__
so that the nn.Module can handle hooks and other housekeeping beforeforward
is called. This seems like a useful separation of tasks.At this point it's just an idea, something to workshop.
Beta Was this translation helpful? Give feedback.
All reactions