title: how to create gradient function for tf.bincount in tensorflow
body: <p>i tried to use <code>optimizer.compute_gradients</code> to calculate a function that has tf.bincount as one of steps, the error message is there is no registered gradient for this function in tensorflow, as shown below</p>
  
  <p>"No gradient defined for operation 'Bincount' (op type: Bincount)"</p>
  
  <p>I then registered my own gradient for this ops, </p>
  
  <pre><code>@ops.RegisterGradient("Bincount")
  def _Bincount_grad(op, grad):
      Tem=tf.constant([1],dtype=tf.float32)
      Bin_index = tf.fill(tf.shape(op.inputs[0]), Tem)
      Mul_index=tf.fill(tf.shape(op.inputs[1]),Tem)
      Const_index=tf.fill(tf.shape(op.inputs[2]),Tem)
      return Bin_index,Mul_index,Const_index'
  </code></pre>
  
  <p>But it keep on throwing error message like </p>
  
  <pre><code>ValueError: No attr named '_XlaCompile' in name: "Bincount"
  op: "Bincount"
  input: "Const"
  input: "mul"
  input: "Relu"
  attr {
    key: "T"
    value {
      type: DT_FLOAT
    }
  }
  tensorflow.python.framework.errors_impl.InvalidArgumentError:
   Shape must be rank 0 but is rank 1 for 'gradients/Bincount_grad/Fill' 
  (op: 'Fill') with input shapes: [2], [1].
  </code></pre>
  
  <p>basically the output should be a list of 1 with length of input value group
  it would be helpful if someone could provide some hint on this subject, i am relative new to tensorflow</p>