title: Keras Implementation of Customized Loss Function that need internal layer output as label
body: <p>in keras, I want to customize my loss function which not only takes (y_true, y_pred) as input but also need to use the output from the internal layer of the network as the label for an output layer.This picture shows the <a href="https://i.stack.imgur.com/UCHFa.png" rel="noreferrer">Network Layout</a></p>
  
  <p>Here, the internal output is xn, which is a 1D feature vector. in the upper right corner, the output is xn', which is the prediction of xn. In other words, xn is the label for xn'. </p>
  
  <p>While [Ax, Ay] is traditionally known as y_true, and [Ax',Ay'] is y_pred.</p>
  
  <p>I want to combine these two loss components into one and train the network jointly. </p>
  
  <p>Any ideas or thoughts are much appreciated!</p>