2017-07-06 97 views

回答

2

不,沒有區別。

tensorflow/tensorflow/python/ops/nn.py文件(這就是tf.nn定義),我們可以發現tanh定義:

from tensorflow.python.ops.math_ops import tanh 

也有這個TODOhere

# TODO(cwhipkey): sigmoid and tanh should not be exposed from tf.nn. 

因此,或許正切將被刪除來自tf.nn包。

因此tf.tanh(定義爲here)是一個使用。

2

他們是完全相同的別名tensorflow.python.ops.math_ops.tanh

同樣的事情發生在tf.sigmoidtf.nn.sigmoid

2

不,沒有任何區別。

兩者的可用性可能是由於圖書館不斷髮展並仍在改變其API,仍處於初始成熟狀態。 我們可以預期,在最終設置主API(我期望2.0)時,圖書館可以避免將來的基本重複。

4

足夠容易確認它們是相同的:

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' 
相關問題