refactor: simplifications in ModuleMeta __call__#999
refactor: simplifications in ModuleMeta __call__#999nstarman wants to merge 13 commits intopatrick-kidger:devfrom
Conversation
40d6df7 to
966b589
Compare
|
|
|
@patrick-kidger I think this is ready for review. |
* feat: converter = None as the sentinel 1. Easier for users to access instead of a private sentinel. 2. simplifies later performance-related logic changes. 3. Broadens support to allow `dataclasses.field(metadata=dict(converter=None))`, not just `eqx.field`. Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com> * refactor: only set annotations if datclass init Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com> --------- Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
* docs: add diffraxtra Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com> * docs: link to list Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com> --------- Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
…ra. This is a bit of a technical nit, but the interface isn't what I would describe as being OOP: which to me refers specifically to mutating state via methods. (If the state is immutable it's a curried function and is FP.)
- Now tracking only the running statistics, not the zero-debiased statistics. These are handled at inference time instead. - Standarised bibtex formatting. - Moved `mode` argument to the end for backward compatibility.
Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
|
So for this one I'm actually planning on doing my |
Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
|
Some possible ideas, inspired from
class MyClass
def __init__(self, ...):
... # Whatever manual processing
self.__dataclass_init__(...) # don't have to worry about setting in frozen vs not, descriptors vs not, etc.Of course it's totally optional to use, it's just very convenient!
def __converter_init__(self, ...):
ba = run_converters(...)
self.__dataclass_init__(**ba)When class MyClass
def __init__(self, ...):
... # Whatever manual processing
self. __converter_init__(...) # handles conversion, and all complexities of setting.Of course it's totally optional to use, it's just very convenient!
|
|
These are an interesting set of ideas! I can totally see why these are attractive for power users. Points (1) and (2) I think probably impose too great a learning curve for new users: we already have Point (3) sounds like an internal optimisation we could probably perform, however. I like the sound of that one. |
|
SGTM. I think we can also do the converter loop as part of the |
No description provided.