(op, grad_loss, _)
| 205 | |
| 206 | # pylint: disable=unused-argument |
| 207 | def _CTCLossGradImpl(op, grad_loss, _): |
| 208 | # Outputs are: loss, grad |
| 209 | # |
| 210 | # Currently there is no way to take the second derivative of this op |
| 211 | # due to the fused implementation's interaction with tf.gradients(), |
| 212 | # so we make sure we prevent silently incorrect results by raising |
| 213 | # an error if the second derivative is requested via prevent_gradient. |
| 214 | grad_without_gradient = array_ops.prevent_gradient( |
| 215 | op.outputs[1], |
| 216 | message="Currently there is no way to take the second " |
| 217 | " derivative of ctc_loss due to the fused implementation's interaction " |
| 218 | " with tf.gradients()") |
| 219 | # Return gradient for inputs and None for |
| 220 | # labels_indices, labels_values and sequence_length |
| 221 | return [_BroadcastMul(grad_loss, grad_without_gradient), None, None, None] |
| 222 | |
| 223 | # pylint: disable=unused-argument |
| 224 | @ops.RegisterGradient("CTCLoss") |
no test coverage detected