Skip to content

Commit

Permalink
Add gradient for tf.reverse(), fixes #58.
Browse files Browse the repository at this point in the history
Change: 110608526
  • Loading branch information
martinwicke authored and Vijay Vasudevan committed Dec 21, 2015
1 parent ef50775 commit 1e416cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tensorflow/python/ops/array_grad.py
Expand Up @@ -265,3 +265,9 @@ def _ReverseSequenceGrad(op, grad):
seq_dim=op.get_attr("seq_dim"),
seq_lengths=seq_lengths),
None]


@ops.RegisterGradient("Reverse")
def _ReverseGrad(op, grad):
reverse_dims = op.inputs[1]
return array_ops.reverse(grad, reverse_dims), None

0 comments on commit 1e416cd

Please sign in to comment.