且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Keras模型中的Tensorflow op

更新时间:2023-12-02 08:49:34

大约两个星期过去了,看来我现在可以回答自己的问题了.

Roughly two weeks have passed and it seems I am able to answer my own question now.

如果您使用注册,则tensorflow似乎可以查找渐变. >装饰器.在撰写本文时,此功能在C ++中尚不可用,而这正是我一直在寻找的功能.一种解决方法是在C ++中定义一个普通的op,并使用提到的装饰器将其包装在python方法中.如果这些具有相应梯度的函数在tensorflow中注册,则反向传播将自动"发生.

It seems like tensorflow can look up gradients if you register them using this decorator. As of writing, this functionality is not (yet) available in C++, which is what I was looking for. A workaround would be to define a normal op in C++ and wrap it in a python method using the mentioned decorator. If these functions with corresponding gradients are registered with tensorflow, backpropagation will happen 'automagically'.