'Keras how to define two complicated loss function

I used Keras to build a lstm to make prediction ,two output layers with it ,defined as out1 , out2 Now I want to combine out1,out2 with ytrue, the three variables to make two loss functions Just like

define myloss

  if out1 < ytrue < out 2 :
  return k=1
  else:
  return k=0
  Loss1= (out1-ytrue)+k
  Loss2= (out2-ytrue)+k


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source