You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to have the following inheritance structure, where subclasses only need to define a function to initialise the static fields, but encountered this unintuitive behavior, where the converter is only applied when __post_init__ is defined for the children.
Reproduce
importabcimportequinoxaseqximportjaximportjax.numpyasjnpclassA(eqx.Module):
a: jax.Array=eqx.field(converter=jnp.asarray)
b: int=eqx.field(init=False, static=True)
def__post_init__(self):
# do something here for all subclassesprint(type(self.a))
self.init_b()
@abc.abstractmethoddefinit_b(self): ...
classB(A):
definit_b(self):
self.b=1classC(A):
def__post_init__(self):
super().__post_init__()
definit_b(self):
self.b=1b=B(0)
c=C(0)
I want to have the following inheritance structure, where subclasses only need to define a function to initialise the static fields, but encountered this unintuitive behavior, where the converter is only applied when
__post_init__
is defined for the children.Reproduce
Output
Expected Output
The text was updated successfully, but these errors were encountered: