vast-community-hub / tensorflow-vast

TensorFlow binding library for VA Smalltalk
MIT License
13 stars 0 forks source link

Unexpected Gradient error (No gradient defined for op: OnesLike) #14

Open jvanecek opened 5 years ago

jvanecek commented 5 years ago

I intend to write the second example in the GradientTape tutorial

x = tf.constant(3.0)
with tf.GradientTape() as g:
  g.watch(x)
  with tf.GradientTape() as gg:
    gg.watch(x)
    y = x * x
  dy_dx = gg.gradient(y, x)     # Will compute to 6.0
d2y_dx2 = g.gradient(dy_dx, x)  # Will compute to 2.0

in TensorFlowCAPITest>>#testNestedGradient but the got the following error

NOT_FOUND: No gradient defined for op: OnesLike. Please see https://www.tensorflow.org/code/tensorflow/cc/gradients/README.md for instructions on how to add C++ gradients.

It seems gradientsOf:respectTo: in VAST is not doing the same as the gradient in python.

(Case reproduced in this commit)