user2426998
user2426998

Reputation: 413

Is there an equivalent of tf.gradients function in tensorflow C or C++ API?

I want to implement a tensorflows function tf.gradients in C or C++ API? Tensorflow C++ has the worst documentation in the world and C API aren't documented at all. Can you suggest if there is an implementation or which API parts should I use to develop this myself.

Upvotes: 0

Views: 316

Answers (1)

Maxxxxxx
Maxxxxxx

Reputation: 71

The C functions that the python function tf.gradients calls on can be found in the following header file:

#include "tensorflow/core/gradients/grad_ops.h"

You can use tensorflow::GradientTape to initialize a tape which the can call on the gradient function to compute the gradient of a tensor y in respect to x.

Upvotes: 0

Related Questions