Different with link1 and link2, now, I have two network with different loss functions respectively, and I want to fit these two models alternately in one batch.
To be specific, if there is one model, A. I train it by the following pseudo code:
model = some_value # initial
for e in 1:epoch
for b in 1:batch
model = train(A, model)
The above procedure can be realized only by one line of code in keras:
model.fit(X_train, Y_train,
batch_size=32, epoch=10)
Now, I have two models, A and B. I train them by the following pseudo code:
model_A = some_value # initial
model_B = some_value # initial
for e in 1:epoch
for b in 1:batch
model_A = train(A, model_B) # I using the model_B in the loss function of neural network model_A
model_B = train(A, model_A) # I using the model_A in the loss function of neural network model_B
How to realize this procedure in keras?