title: Keras custom loss implementation : ValueError: An operation has `None` for gradient
body: <p>I'm trying to implement this loss function : <a href="https://i.stack.imgur.com/8ZtEt.png" rel="nofollow noreferrer">MCFD_loss_function</a>
  from this document (P6) : <a href="http://www.faculty.ucr.edu/~taelee/paper/lossfunctions.pdf" rel="nofollow noreferrer">Loss functions</a></p>
  
  <p>So I created a new function like this : </p>
  
  <pre><code>def mcfd_loss(y_true, y_pred):
      return K.sum( # ∑
          K.cast(
              K.greater( # only values greater than 0 (+ float32 cast)
                    K.dot(K.sign(y_pred),  # π
                          K.sign(y_true))
             , 0)
          , 'float32')
      )
  </code></pre>
  
  <p>But when I start training this error is raised :</p>
  
  <blockquote>
    <p>ValueError: An operation has <code>None</code> for gradient. Please make sure that all of your ops have a gradient defined (i.e. are differentiable). Common ops without gradient: K.argmax, K.round, K.eval.</p>
  </blockquote>
  
  <p>I don't know which point I missed. The error seems to be raised because I use greater function. I don't know what does this error mean and how to correct my problem.</p>
  
  <p>Thanks.</p>