Skip to content

tf.gradients producing unexpected results  #303

Closed
@moloneymb

Description

@moloneymb

It appears that the tf.gradients function has a bug in it.

For the example x^3 * 0.1 should be 3x^2 * 0.1 but it appears to be x^2 * 0.1.

In TF.Net

let x = tf.constant(7.0)
let y = x*x*x*tf.constant(0.1)
sess.run(tf.gradients(y,x)).[0].Data<double>()
//[|4.9|]

In Python

x = tf.constant(7.0)
y = x*x*x*tf.constant(0.1)
sess.run(tf.gradients(y,x))
#[14.7]

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions