tf.nn.conv2d 与 tf.layers.conv2d [英] tf.nn.conv2d vs tf.layers.conv2d
问题描述
使用 tf.nn.*
比使用 tf.layers.*
有什么优势吗?
Is there any advantage in using tf.nn.*
over tf.layers.*
?
例如,文档中的大多数示例都使用 tf.nn.conv2d
,但不清楚为什么要这样做.
Most of the examples in the doc use tf.nn.conv2d
, for instance, but it is not clear why they do so.
推荐答案
对于卷积,它们是一样的.更准确地说,tf.layers.conv2d
(实际上是 _Conv
)使用 tf.nn.convolution
作为后端.您可以遵循以下调用链:tf.layers.conv2d>Conv2D>Conv2D.apply()>_Conv>_Conv.apply()>_Layer.apply()>_Layer.\__call__()>_Conv.call()>nn.convolution()...
For convolution, they are the same. More precisely, tf.layers.conv2d
(actually _Conv
) uses tf.nn.convolution
as the backend. You can follow the calling chain of: tf.layers.conv2d>Conv2D>Conv2D.apply()>_Conv>_Conv.apply()>_Layer.apply()>_Layer.\__call__()>_Conv.call()>nn.convolution()...
这篇关于tf.nn.conv2d 与 tf.layers.conv2d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!