Module that is flexible in which submodule is used #1026
-
Hi, related to #665 and #686 I'm currently porting JaxRk to use FLAX. What I want is to write Modules (like
Is this the best way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think that after 9bf7161 was committed, you should be able to simply pass an unbound module instance from the top-level without wrapping in a lambda. Could you give it a shot? e.g. (On another note, there's no need to define empty (Oh, and your |
Beta Was this translation helpful? Give feedback.
I think that after 9bf7161 was committed, you should be able to simply pass an unbound module instance from the top-level without wrapping in a lambda. Could you give it a shot?
e.g.
model = AverageSimilarity(LaplaceSimilarity(3.))
(On another note, there's no need to define empty
setup
methods)(Oh, and your
LaplaceSimilarity
class doesn't really need to be a module as it doesn't hold variables. You could simply make it a vanilla Python dataclass)