当前位置: 首页>>代码示例>>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;未经允许,请勿转载。