本文整理匯總了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)
示例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))
示例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))