I have an encoder class that is defined in a class in PyTorch. I want to use this model for two parallel models as follows. could you help me to solve that?
class Encoder(nn.Module):
....```
model 1
optimizer = torch.optim.Adam(model1.parameters(), lr=6e-4)
losses = train(model1, device, 100, data1, optimizer)
model2
model2 = Encoder(100, 1, 2, 10, device).to(device)
optimizer = torch.optim.Adam(model2.parameters(), lr=6e-4)
losses = train(model2, device, 100, data2, optimizer)
Here is the figure which I want: