Hi,
Say I have created the above model:
first_seq = nn.Sequential( do stuff…)
second_seq = nn.Sequential( do more stuff…)
class My_First_Model (nn.Module):
def init(self, first_seq, second_seq ):
super(My_First_Model, self).init()
self.first = first_seq
self.second = second_seq
def forward(self, x):
x = self.first(x)
x = self.second(x)
return x
model_1 = My_First_Model()
train model
No I want to use the models “self.first” in another model, for example:
class My_second_Model (nn.Module):
def init(self, input_Sequential):
super(My_second_Model, self).init()
self.first = input_Sequential
self.second = nn.Sequential( do stuff...)
def forward(self, x):
x = self.first(x)
x = self.second(x)
return x
model_2 = My_second_Model ( model_1.self.first )
train model_2
The question is: will the input sequential into model_2 (model_1.self.first) will contain the wights learned during the first training? and not the initial weights assigned when defined (first_seq = nn.Sequential( do stuff…)) ?
I hope my question is understandable,
Thanks!