I want to do something like:
class Foo(nn.Module):
def __init__(self, featurizer):
self.featurizer = featurizer
....
… so I want to use featurizer in the forward
method. But I dont want featurizer (which is derived from nn.Module
) to have its parameters included in the .parameters()
of a Foo
object.
How to achieve this? I know I could do eg assign a list to Foo
, and then add the featurizer to this list, but that seems a bit … convoluted. Wodnering if there is some simpler way?
(edit: for now, I’ve done exactly the create a list thing:
self.featurizer_l = [featurizer]
and in forward:
x = self.featurizer_l[0](x)