I’m trying to solve the following problem. I want to create a Gluon Block that depends on user-provided Block. I.e. in constructor it takes another Block. Think of seq2seq model that allows to provide custom encoders. Just passing already created Block in constructor is not ideal, because the passed Block would end up having “wrong” name scope.
My workaround for this is applying lazy Block creation. Instead of passing already created Block, I could pass a callable that creates it (e.g. partial(Block, **args). This is a slight annoyance for my Block’s users though.
Can you think of any better solution of this problem?