简体   繁体   English

tensorflow C 或 C++ API 中是否存在等效于 tf.gradients function 的值?

[英]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?我想在 C 或 C++ API 中实现一个 tensorflows function tf.gradients Tensorflow C++ has the worst documentation in the world and C API aren't documented at all. Tensorflow C++ 拥有世界上最糟糕的文档,而 C API 则根本没有记录。 Can you suggest if there is an implementation or which API parts should I use to develop this myself.你能建议我是否有一个实现或者我应该使用哪个 API 部分来自己开发这个。

The C functions that the python function tf.gradients calls on can be found in the following header file: python function tf.gradients调用的 C 函数可以在以下 header 文件中找到:

#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 .您可以使用tensorflow::GradientTape来初始化一个磁带,它可以调用gradient function 来计算张量y相对于x的梯度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM