Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

1
  • 2
    I actually tried that a few hours after posting. And I was puzzled by what I saw. Keras did not give me an error, but the loss went immediately to NaN. Eventually I solved the problem. The calling convention for a Keras loss function is first y_true, then y_pred -- or as I call them, tgt and pred. But the calling convention for a TensorFlow loss function is pred first, then tgt. So this fix works: def keras_l2_angle_distance(tgt, pred): return l2_angle_distance(pred, tgt). Maybe Theano or CNTK uses the same order as Keras, I don't know. But I'm back in business. Commented Jan 2, 2018 at 6:57