Build model from repeated template
<SCODE>class Template(nn.Module):
    def __init__(self):
        super().__init__()
    def forward(self, *input):
        pass
<ECODE> <SCODE>class BuildModel(nn.Module):
    def __init__(self, number_of_layers):
        super().__init__()
        # self.layer_n = Template() for n in range(0, number_of_layers)
    def forward(self, *input):
        pass
<ECODE>
Atcold
trypag
<SCODE>b - a - A - B
<ECODE> <SCODE>c - b - a - A - B - C
<ECODE>
Atcold
Just about the nn.Sequential point, I implemented a network with 3 branches in parallel, I am not using nn.Sequential, I just end up summing the variables of my branches, this is pure autograd. Hope it can help
trypag
what about <SCODE>def template(num_layers):
    if num_layers == 1:
        return nn.Sequential([a,A])
    else:
        return nn.Sequential([f(num_layers), template(num_layers-1), F(num_layers)])
<ECODE>
ClementPinard
Atcold
apaszke
Also, we’ll be merging an official solution into the core today or tomorrow.
apaszke
Oh, that would be great. I would have been mucking around with string based attribute settings, otherwise … which should be just fine, no?
Atcold
apaszke
Atcold