當前位置: 首頁>>代碼示例>>Python>>正文


Python model_helpers.past_stop_threshold方法代碼示例

本文整理匯總了Python中official.utils.misc.model_helpers.past_stop_threshold方法的典型用法代碼示例。如果您正苦於以下問題:Python model_helpers.past_stop_threshold方法的具體用法?Python model_helpers.past_stop_threshold怎麽用?Python model_helpers.past_stop_threshold使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在official.utils.misc.model_helpers的用法示例。


在下文中一共展示了model_helpers.past_stop_threshold方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_past_stop_threshold_not_number

# 需要導入模塊: from official.utils.misc import model_helpers [as 別名]
# 或者: from official.utils.misc.model_helpers import past_stop_threshold [as 別名]
def test_past_stop_threshold_not_number(self):
    """Tests for error conditions."""
    with self.assertRaises(ValueError):
      model_helpers.past_stop_threshold("str", 1)

    with self.assertRaises(ValueError):
      model_helpers.past_stop_threshold("str", tf.constant(5))

    with self.assertRaises(ValueError):
      model_helpers.past_stop_threshold("str", "another")

    with self.assertRaises(ValueError):
      model_helpers.past_stop_threshold(0, None)

    with self.assertRaises(ValueError):
      model_helpers.past_stop_threshold(0.7, "str")

    with self.assertRaises(ValueError):
      model_helpers.past_stop_threshold(tf.constant(4), None) 
開發者ID:rockyzhengwu,項目名稱:nsfw,代碼行數:21,代碼來源:model_helpers_test.py

示例2: test_past_stop_threshold

# 需要導入模塊: from official.utils.misc import model_helpers [as 別名]
# 或者: from official.utils.misc.model_helpers import past_stop_threshold [as 別名]
def test_past_stop_threshold(self):
    """Tests for normal operating conditions."""
    self.assertTrue(model_helpers.past_stop_threshold(0.54, 1))
    self.assertTrue(model_helpers.past_stop_threshold(54, 100))
    self.assertFalse(model_helpers.past_stop_threshold(0.54, 0.1))
    self.assertFalse(model_helpers.past_stop_threshold(-0.54, -1.5))
    self.assertTrue(model_helpers.past_stop_threshold(-0.54, 0))
    self.assertTrue(model_helpers.past_stop_threshold(0, 0))
    self.assertTrue(model_helpers.past_stop_threshold(0.54, 0.54)) 
開發者ID:rockyzhengwu,項目名稱:nsfw,代碼行數:11,代碼來源:model_helpers_test.py

示例3: test_past_stop_threshold_none_false

# 需要導入模塊: from official.utils.misc import model_helpers [as 別名]
# 或者: from official.utils.misc.model_helpers import past_stop_threshold [as 別名]
def test_past_stop_threshold_none_false(self):
    """Tests that check None returns false."""
    self.assertFalse(model_helpers.past_stop_threshold(None, -1.5))
    self.assertFalse(model_helpers.past_stop_threshold(None, None))
    self.assertFalse(model_helpers.past_stop_threshold(None, 1.5))
    # Zero should be okay, though.
    self.assertTrue(model_helpers.past_stop_threshold(0, 1.5)) 
開發者ID:rockyzhengwu,項目名稱:nsfw,代碼行數:9,代碼來源:model_helpers_test.py


注:本文中的official.utils.misc.model_helpers.past_stop_threshold方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。