I want to compute a loss function which uses output of the network twice on different inputs. For example as hypothetically,
first_output = model(first_input)
second_output = model(second_input)
loss = mean_absolute_error(first_output, second_output)
How to achieve this in tensorflow or keras?
Update: Thank you guys for replies. I want to reimplement this paper in keras or tensorflow. As explained in it, "critic" network which is discriminator in GAN has two inputs and run through them one by one and compute loss function depending on outputs and compute gradient. Main problem is how to make possible in tensorflow or keras?