Hi, new to Keras here. I'm moving from a custom neural net API to (hopefully) Keras so that I can reduce my prototyping time and reduce my work load in general. Though, for my specific uses, I'm having some trouble with the transition.
This is possibly a weird question, since what I'm doing is non-standard.
What I need is (In pseudo-code):
Assume I have defined two models: model1 and model2
Key:
Green: I can do this
Red: This is what I need
-------------------PSEUDO-CODE BELOW--------------------
begin batch loop:
input1, input2, target = get_input_batch_data() # Mine - this returns two different inputs for two disjoint neural networks and a set of target data
output1 = model1.feed_forward_only(input1) # Keras ... This isn't the problem because I can use model.predict_on_batch() for this.
output2 = model2.feed_forward_only(input2) # Keras again
predicted = custom_forward_mapping_function(output1,output2) # Mine - don't worry about what this does - just know that my actual loss is based on two different outputs from two distinct networks
total_grads = loss (predicted,target) # Mine - this isn't a problem as I can do this myself easily
grads1, grads2 = custom_backward_mapping_function(total_grads) # Mine - again, don't worry what this does
model1.backprop_and_update(grads1) # I need a function that does this
model2.backprop_and_update(grads2) # ^ ditto
end batch loop:
-------------------------------------------------------------------------
So, point is, I need a function that simply allows me to do back propagation of a model given gradients. I couldn't find anything in the documentation about this. All training functions (many/single batch) seem to be a single call that does feed forward, loss and backprop/update all at once. This won't work for me.
Thanks!
Justin