Skip to content

tf.gradients() gives the conjugate of what is expected #3348

@whdc

Description

@whdc

tf.gradients(), when used on complex numbers, erroneously flips the sign of the imaginary part:

>>> x = tf.Variable(0. + 0.j)
>>> sess.run(tf.gradients(x*x, x), feed_dict={x:0.1j})
[-0.20000000000000001j]
>>> sess.run(tf.gradients(tf.exp(x), x), feed_dict={x:0.1j})
[(0.99500416527802571-0.099833416646828155j)]

I expect 0.2j and 0.99500416527802571+0.099833416646828155j.

I'm running version 0.9.0, CPU only, on OS X.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions