Machine learning tensorflow中的激活功能之间有区别吗?坦恩对坦恩

Machine learning tensorflow中的激活功能之间有区别吗?坦恩对坦恩,machine-learning,tensorflow,computer-vision,Machine Learning,Tensorflow,Computer Vision,我想建立一个神经网络,我问自己这两种功能之间是否有区别 tf.nn.tanh与tf.tanh它们与tensorflow.python.ops.math_ops.tanh完全相同 同样的事情也适用于tf.sigmoid和tf.nn.sigmoid不,没有区别 在tensorflow/tensorflow/python/ops/nn.py文件(定义了tf.nn)中,我们可以找到tanh的定义: from tensorflow.python.ops.math_ops import tanh 另外,还

我想建立一个神经网络,我问自己这两种功能之间是否有区别


tf.nn.tanh与tf.tanh

它们与
tensorflow.python.ops.math_ops.tanh
完全相同


同样的事情也适用于
tf.sigmoid
tf.nn.sigmoid
不,没有区别

tensorflow/tensorflow/python/ops/nn.py
文件(定义了
tf.nn
)中,我们可以找到
tanh
的定义:

from tensorflow.python.ops.math_ops import tanh
另外,还有这个
TODO

因此,tanh可能会从
tf.nn
包中删除


因此
tf.tanh
(已定义)是要使用的。

不,没有任何区别

这两者的可用性可能是由于库不断发展并仍在更改其API,仍处于成熟的初始状态。
当主API最终设置时(我希望在2.0版本时),我们可以期望库避免这些基本的重复操作。

很容易确认它们是相同的:

In [1]: import tensorflow as tf

In [2]: tf.nn.tanh
Out[2]: <function tensorflow.python.ops.math_ops.tanh>

In [3]: tf.tanh
Out[3]: <function tensorflow.python.ops.math_ops.tanh>

In [4]: tf.nn.tanh == tf.tanh
Out[4]: True

In [5]: tf.__version__
Out[5]: '0.11.0rc1'
[1]中的
:将tensorflow作为tf导入
In[2]:tf.nn.tanh
出[2]:
In[3]:tf.tanh
出[3]:
[4]中:tf.nn.tanh==tf.tanh
Out[4]:正确
[5]中:tf.\u版本__
输出[5]:“0.11.0rc1”
In [1]: import tensorflow as tf

In [2]: tf.nn.tanh
Out[2]: <function tensorflow.python.ops.math_ops.tanh>

In [3]: tf.tanh
Out[3]: <function tensorflow.python.ops.math_ops.tanh>

In [4]: tf.nn.tanh == tf.tanh
Out[4]: True

In [5]: tf.__version__
Out[5]: '0.11.0rc1'