当前位置: 首页>>代码示例>>Python>>正文


Python inputs._replace_empty_string_with_random_number方法代码示例

本文整理汇总了Python中object_detection.inputs._replace_empty_string_with_random_number方法的典型用法代码示例。如果您正苦于以下问题:Python inputs._replace_empty_string_with_random_number方法的具体用法?Python inputs._replace_empty_string_with_random_number怎么用?Python inputs._replace_empty_string_with_random_number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object_detection.inputs的用法示例。


在下文中一共展示了inputs._replace_empty_string_with_random_number方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_output_is_integer_in_replace_empty_string_with_random_number

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import _replace_empty_string_with_random_number [as 别名]
def test_output_is_integer_in_replace_empty_string_with_random_number(self):

    string_placeholder = tf.placeholder(tf.string, shape=[])
    replaced_string = inputs._replace_empty_string_with_random_number(
        string_placeholder)

    empty_string = ''
    feed_dict = {string_placeholder: empty_string}

    tf.set_random_seed(0)

    with self.test_session() as sess:
      out_string = sess.run(replaced_string, feed_dict=feed_dict)

    # Test whether out_string is a string which represents an integer.
    int(out_string)  # throws an error if out_string is not castable to int.

    self.assertEqual(out_string, '2798129067578209328') 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:20,代码来源:inputs_test.py

示例2: test_output_is_integer_in_replace_empty_string_with_random_number

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import _replace_empty_string_with_random_number [as 别名]
def test_output_is_integer_in_replace_empty_string_with_random_number(self):

    string_placeholder = tf.placeholder(tf.string, shape=[])
    replaced_string = inputs._replace_empty_string_with_random_number(
        string_placeholder)

    empty_string = ''
    feed_dict = {string_placeholder: empty_string}
    with self.test_session() as sess:
      out_string = sess.run(replaced_string, feed_dict=feed_dict)

    is_integer = True
    try:
      # Test whether out_string is a string which represents an integer, the
      # casting below will throw an error if out_string is not castable to int.
      int(out_string)
    except ValueError:
      is_integer = False

    self.assertTrue(is_integer) 
开发者ID:tensorflow,项目名称:models,代码行数:22,代码来源:inputs_test.py

示例3: test_output_equal_in_replace_empty_string_with_random_number

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import _replace_empty_string_with_random_number [as 别名]
def test_output_equal_in_replace_empty_string_with_random_number(self):
    string_placeholder = tf.placeholder(tf.string, shape=[])
    replaced_string = inputs._replace_empty_string_with_random_number(
        string_placeholder)

    test_string = 'hello world'
    feed_dict = {string_placeholder: test_string}

    with self.test_session() as sess:
      out_string = sess.run(replaced_string, feed_dict=feed_dict)

    self.assertEqual(test_string, out_string) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:14,代码来源:inputs_test.py

示例4: test_output_equal_in_replace_empty_string_with_random_number

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import _replace_empty_string_with_random_number [as 别名]
def test_output_equal_in_replace_empty_string_with_random_number(self):
    string_placeholder = tf.placeholder(tf.string, shape=[])
    replaced_string = inputs._replace_empty_string_with_random_number(
        string_placeholder)

    test_string = b'hello world'
    feed_dict = {string_placeholder: test_string}

    with self.test_session() as sess:
      out_string = sess.run(replaced_string, feed_dict=feed_dict)

    self.assertEqual(test_string, out_string) 
开发者ID:tensorflow,项目名称:models,代码行数:14,代码来源:inputs_test.py


注:本文中的object_detection.inputs._replace_empty_string_with_random_number方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。