Gradient for log

1

2

3

4

5

6

7

8

9

10

11

12

13

@RegisterGradient("log")

def _log_gradient(op, grad):

"""Computes the gradients for `log`.

Args:

op: The `log` `Operation` that we are differentiating

grad: Gradient with respect to the output of the `log` op.

Returns:

Gradients with respect to the input of `log`.

"""

x = op.inputs[0]

return grad/x

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX