简体   繁体   English

Tensorflow 中的可微操作列表

[英]List of Differentiable Ops in Tensorflow

Is there a master list of Tensorflow ops that are differentiable (ie, will auto-differentiate)?是否有可微分的 Tensorflow 操作主列表(即,会自动微分)?

Two other ways to phrase this:其他两种表达方式:

  • List of ops that do not have ops.NoGradient set.未设置ops.NoGradient的操作列表。
  • List of ops that will not trigger LookupError .不会触发LookupError的操作列表。

For example, I'd assume that all the Control Flow ops are not differentiable (eg, tf.where ).例如,我假设所有控制流操作都是不可微的(例如, tf.where )。 How would I find this other than by manually running them all through tf.gradients to see if they throw the LookupError .除了通过tf.gradients手动运行它们以查看它们是否抛出LookupError之外,我如何找到它。

"Commonsense" is not a valid answer. “常识”不是一个有效的答案。

Thanks.谢谢。

EDIT:编辑:

tf.where is differentiable so my intuitions are wrong. tf.where是可微的,所以我的直觉是错误的。 Perhaps the correct question here is which ops in Tensorflow are not differentiable.也许这里的正确问题是 Tensorflow 中的哪些操作是不可微的。

Thanks.谢谢。

I have devised the entire list of Differentiable and Non-Differentiable Ops using python code.我使用 python 代码设计了完整的可微分和不可微分操作列表。

You will find the compact list here.您将在此处找到精简列表。 Also the code which generated it.还有生成它的代码。

https://github.com/Mainak431/List-of-Differentiable--OPs-and-Non-differentiable-OPs--in-Tensorflow https://github.com/Mainak431/List-of-Differentiable--OPs-and-Non-differentiable-OPs--in-Tensorflow

No, there is no list (you can be the first one to create it).不,没有列表(您可以是第一个创建它的人)。 Also as far as I am aware, documentation of each function also does not tell it ( tf.size is non-differentiable but does not tell about it).另外据我所知,每个函数的文档也没有告诉它( tf.size是不可微的,但没有告诉它)。

Apart from the way you suggested, you can also extract this data from the source code.除了您建议的方式之外,您还可以从源代码中提取此数据。 For example all the ops that have gradient implemented, have @ops.RegisterGradient in front of the method declaration.例如,所有实现了渐变的操作,在方法声明前都有@ops.RegisterGradient For ops which do not have gradient you will have ops.NotDifferentiable(对于没有梯度的操作,你将有ops.NotDifferentiable(

Not related, but probably helpful .不相关,但可能有帮助

对于 TensorFlow 2,似乎tf.raw_ops模块文档中提供了这样的列表。

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

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