• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python resource_loader.get_root_dir_with_all_resources函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tensorflow.python.platform.resource_loader.get_root_dir_with_all_resources函数的典型用法代码示例。如果您正苦于以下问题:Python get_root_dir_with_all_resources函数的具体用法?Python get_root_dir_with_all_resources怎么用?Python get_root_dir_with_all_resources使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __init__

  def __init__(self, *args, **kwargs):
    super(ApiCompatibilityTest, self).__init__(*args, **kwargs)

    golden_update_warning_filename = os.path.join(
        resource_loader.get_root_dir_with_all_resources(), _UPDATE_WARNING_FILE)
    self._update_golden_warning = file_io.read_file_to_string(
        golden_update_warning_filename)

    test_readme_filename = os.path.join(
        resource_loader.get_root_dir_with_all_resources(), _TEST_README_FILE)
    self._test_readme_message = file_io.read_file_to_string(
        test_readme_filename)
开发者ID:aeverall,项目名称:tensorflow,代码行数:12,代码来源:api_compatibility_test.py


示例2: testAPIBackwardsCompatibilityV1

 def testAPIBackwardsCompatibilityV1(self):
   api_version = 1
   golden_file_pattern = os.path.join(
       resource_loader.get_root_dir_with_all_resources(),
       _KeyToFilePath('*', api_version))
   self._checkBackwardsCompatibility(tf_v2.compat.v1, golden_file_pattern,
                                     api_version)
开发者ID:aeverall,项目名称:tensorflow,代码行数:7,代码来源:api_compatibility_test.py


示例3: testAPIBackwardsCompatibility

  def testAPIBackwardsCompatibility(self):
    # Extract all API stuff.
    visitor = python_object_to_proto_visitor.PythonObjectToProtoVisitor()

    public_api_visitor = public_api.PublicAPIVisitor(visitor)
    public_api_visitor.do_not_descend_map['tf'].append('contrib')
    public_api_visitor.do_not_descend_map['tf.GPUOptions'] = ['Experimental']
    traverse.traverse(tf, public_api_visitor)

    proto_dict = visitor.GetProtos()

    # Read all golden files.
    expression = os.path.join(
        resource_loader.get_root_dir_with_all_resources(),
        _KeyToFilePath('*'))
    golden_file_list = file_io.get_matching_files(expression)

    def _ReadFileToProto(filename):
      """Read a filename, create a protobuf from its contents."""
      ret_val = api_objects_pb2.TFAPIObject()
      text_format.Merge(file_io.read_file_to_string(filename), ret_val)
      return ret_val

    golden_proto_dict = {
        _FileNameToKey(filename): _ReadFileToProto(filename)
        for filename in golden_file_list
    }

    # Diff them. Do not fail if called with update.
    # If the test is run to update goldens, only report diffs but do not fail.
    self._AssertProtoDictEquals(
        golden_proto_dict,
        proto_dict,
        verbose=FLAGS.verbose_diffs,
        update_goldens=FLAGS.update_goldens)
开发者ID:DILASSS,项目名称:tensorflow,代码行数:35,代码来源:api_compatibility_test.py


示例4: testAPIBackwardsCompatibilityV1

 def testAPIBackwardsCompatibilityV1(self):
   if not tf_v1:
     return
   golden_file_pattern = os.path.join(
       resource_loader.get_root_dir_with_all_resources(),
       _KeyToFilePath('*'))
   self.checkBackwardsCompatibility(tf_v1, golden_file_pattern)
开发者ID:dan-lennox,项目名称:tensorflow,代码行数:7,代码来源:api_compatibility_test.py


示例5: _GetBaseApiMap

  def _GetBaseApiMap(self):
    """Get a map from graph op name to its base ApiDef.

    Returns:
      Dictionary mapping graph op name to corresponding ApiDef.
    """
    # Convert base ApiDef in Multiline format to Proto format.
    converted_base_api_dir = os.path.join(
        test.get_temp_dir(), 'temp_base_api_defs')
    subprocess.check_call(
        [os.path.join(resource_loader.get_root_dir_with_all_resources(),
                      _CONVERT_FROM_MULTILINE_SCRIPT),
         _BASE_API_DIR, converted_base_api_dir])

    name_to_base_api_def = {}
    base_api_files = file_io.get_matching_files(
        os.path.join(converted_base_api_dir, 'api_def_*.pbtxt'))
    for base_api_file in base_api_files:
      if file_io.file_exists(base_api_file):
        api_defs = api_def_pb2.ApiDefs()
        text_format.Merge(
            file_io.read_file_to_string(base_api_file), api_defs)
        for api_def in api_defs.op:
          name_to_base_api_def[api_def.graph_op_name] = api_def
    return name_to_base_api_def
开发者ID:AbhinavJain13,项目名称:tensorflow,代码行数:25,代码来源:api_compatibility_test.py


示例6: testAPIBackwardsCompatibilityV2

 def testAPIBackwardsCompatibilityV2(self):
   api_version = 2
   golden_file_pattern = os.path.join(
       resource_loader.get_root_dir_with_all_resources(),
       _KeyToFilePath('*', api_version))
   self._checkBackwardsCompatibility(
       tf_v2, golden_file_pattern, api_version,
       additional_private_map={'tf.compat': ['v1']})
开发者ID:ThunderQi,项目名称:tensorflow,代码行数:8,代码来源:api_compatibility_test.py


示例7: testAPIBackwardsCompatibilityV1

 def testAPIBackwardsCompatibilityV1(self):
   api_version = 1
   golden_file_pattern = os.path.join(
       resource_loader.get_root_dir_with_all_resources(),
       _KeyToFilePath('*', api_version))
   self._checkBackwardsCompatibility(
       tf.compat.v1, golden_file_pattern, api_version,
       additional_private_map={'tf': ['pywrap_tensorflow']},
       omit_golden_symbols_map={'tensorflow': ['pywrap_tensorflow']})
开发者ID:adit-chandra,项目名称:tensorflow,代码行数:9,代码来源:api_compatibility_test.py


示例8: testAPIBackwardsCompatibility

 def testAPIBackwardsCompatibility(self):
   api_version = 1
   golden_file_pattern = os.path.join(
       resource_loader.get_root_dir_with_all_resources(),
       _KeyToFilePath('*', api_version))
   self._checkBackwardsCompatibility(
       tf,
       golden_file_pattern,
       api_version,
       # Skip compat.v1 and compat.v2 since they are validated
       # in separate tests.
       additional_private_map={'tf.compat': ['v1', 'v2']})
开发者ID:ThunderQi,项目名称:tensorflow,代码行数:12,代码来源:api_compatibility_test.py


示例9: get_filepath

def get_filepath(filename, base_dir=None):
  """Returns the full path of the filename.

  Args:
    filename: Subdirectory and name of the model file.
    base_dir: Base directory containing model file.

  Returns:
    str.
  """
  if base_dir is None:
    base_dir = "learning/brain/mobile/tflite_compat_models"
  return os.path.join(_resource_loader.get_root_dir_with_all_resources(),
                      base_dir, filename)
开发者ID:aritratony,项目名称:tensorflow,代码行数:14,代码来源:model_coverage_lib.py


示例10: testNewAPIBackwardsCompatibility

  def testNewAPIBackwardsCompatibility(self):
    # Extract all API stuff.
    visitor = python_object_to_proto_visitor.PythonObjectToProtoVisitor()

    public_api_visitor = public_api.PublicAPIVisitor(visitor)
    public_api_visitor.do_not_descend_map['tf'].append('contrib')
    public_api_visitor.do_not_descend_map['tf.GPUOptions'] = ['Experimental']
    # TODO(annarev): Make slide_dataset available in API.
    public_api_visitor.private_map['tf'] = ['slide_dataset']
    traverse.traverse(api, public_api_visitor)

    proto_dict = visitor.GetProtos()

    # Read all golden files.
    expression = os.path.join(
        resource_loader.get_root_dir_with_all_resources(),
        _KeyToFilePath('*'))
    golden_file_list = file_io.get_matching_files(expression)

    def _ReadFileToProto(filename):
      """Read a filename, create a protobuf from its contents."""
      ret_val = api_objects_pb2.TFAPIObject()
      text_format.Merge(file_io.read_file_to_string(filename), ret_val)
      return ret_val

    golden_proto_dict = {
        _FileNameToKey(filename): _ReadFileToProto(filename)
        for filename in golden_file_list
    }

    # user_ops is an empty module. It is currently available in TensorFlow API
    # but we don't keep empty modules in the new API.
    # We delete user_ops from golden_proto_dict to make sure assert passes
    # when diffing new API against goldens.
    # TODO(annarev): remove user_ops from goldens once we switch to new API.
    tf_module = golden_proto_dict['tensorflow'].tf_module
    for i in range(len(tf_module.member)):
      if tf_module.member[i].name == 'user_ops':
        del tf_module.member[i]
        break

    # Diff them. Do not fail if called with update.
    # If the test is run to update goldens, only report diffs but do not fail.
    self._AssertProtoDictEquals(
        golden_proto_dict,
        proto_dict,
        verbose=FLAGS.verbose_diffs,
        update_goldens=False,
        additional_missing_object_message=
        'Check if tf_export decorator/call is missing for this symbol.')
开发者ID:PuchatekwSzortach,项目名称:tensorflow,代码行数:50,代码来源:api_compatibility_test.py


示例11: testAPIBackwardsCompatibilityV2

 def testAPIBackwardsCompatibilityV2(self):
   api_version = 2
   golden_file_pattern = os.path.join(
       resource_loader.get_root_dir_with_all_resources(),
       _KeyToFilePath('*', api_version))
   omit_golden_symbols_map = {}
   if FLAGS.only_test_core_api:
     # In TF 2.0 these summary symbols are imported from TensorBoard.
     omit_golden_symbols_map['tensorflow.summary'] = [
         'audio', 'histogram', 'image', 'scalar', 'text']
   self._checkBackwardsCompatibility(
       tf.compat.v2,
       golden_file_pattern,
       api_version,
       additional_private_map={'tf.compat': ['v1', 'v2']},
       omit_golden_symbols_map=omit_golden_symbols_map)
开发者ID:adit-chandra,项目名称:tensorflow,代码行数:16,代码来源:api_compatibility_test.py


示例12: testAPIBackwardsCompatibility

  def testAPIBackwardsCompatibility(self):
    api_version = 1
    golden_file_pattern = os.path.join(
        resource_loader.get_root_dir_with_all_resources(),
        _KeyToFilePath('*', api_version))
    self._checkBackwardsCompatibility(
        tf,
        golden_file_pattern,
        api_version,
        # Skip compat.v1 and compat.v2 since they are validated
        # in separate tests.
        additional_private_map={'tf.compat': ['v1', 'v2']})

    # Also check that V1 API has contrib
    self.assertTrue(
        'tensorflow.python.util.lazy_loader.LazyLoader'
        in str(type(tf.contrib)))
开发者ID:aeverall,项目名称:tensorflow,代码行数:17,代码来源:api_compatibility_test.py


示例13: _initObjectDetectionArgs

  def _initObjectDetectionArgs(self):
    # Initializes the arguments required for the object detection model.
    # Looks for the model file which is saved in a different location interally
    # and externally.
    filename = resource_loader.get_path_to_datafile('testdata/tflite_graph.pb')
    if not os.path.exists(filename):
      filename = os.path.join(
          resource_loader.get_root_dir_with_all_resources(),
          '../tflite_mobilenet_ssd_quant_protobuf/tflite_graph.pb')
      if not os.path.exists(filename):
        raise IOError("File '{0}' does not exist.".format(filename))

    self._graph_def_file = filename
    self._input_arrays = ['normalized_input_image_tensor']
    self._output_arrays = [
        'TFLite_Detection_PostProcess', 'TFLite_Detection_PostProcess:1',
        'TFLite_Detection_PostProcess:2', 'TFLite_Detection_PostProcess:3'
    ]
    self._input_shapes = {'normalized_input_image_tensor': [1, 300, 300, 3]}
开发者ID:aeverall,项目名称:tensorflow,代码行数:19,代码来源:lite_test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python resource_loader.load_resource函数代码示例发布时间:2022-05-27
下一篇:
Python resource_loader.get_path_to_datafile函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap