1. 程式人生 > >[Python] Tensorflow Unit Test 框架

[Python] Tensorflow Unit Test 框架

Tensorflow Unit Test 框架

  1. tf.test.main
  2. tf.test.TestCase
import tensorflow as tf
class AlexnetV2Test(tf.test.TestCase):
    def testBuild(self):
        self.assertEquals(name, 'alexnet_v2/fc8/squeezed')

if __name__ == '__main__':
  tf.test.main()

模組是物件,並且所有的模組都有一個內建屬性 name。一個模組的 name 的值取決於您如何應用模組。如果 import 一個模組,那麼模組__name__ 的值通常為模組檔名,不帶路徑或者副檔名。但是您也可以像一個標準的程式樣直接執行模組,在這 種情況下, name

的值將是一個特別預設"main"。

在cmd 中直接執行.py檔案,則__name__的值是'main';