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


Python resource_loader.get_path_to_datafile方法代碼示例

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


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

示例1: load_op_library

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def load_op_library(path):
  """Loads a contrib op library from the given path.

  NOTE(mrry): On Windows, we currently assume that contrib op
  libraries are statically linked into the main TensorFlow Python
  extension DLL.

  Args:
    path: An absolute path to a shared object file.

  Returns:
    A Python module containing the Python wrappers for Ops defined in the
    plugin.
  """
  if os.name != 'nt':
    path = resource_loader.get_path_to_datafile(path)
    ret = load_library.load_op_library(path)
    assert ret, 'Could not load %s' % path
    return ret
  else:
    # NOTE(mrry):
    return None 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:24,代碼來源:loader.py

示例2: _load_library

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def _load_library(name, op_list=None):
  """Loads a .so file containing the specified operators.

  Args:
    name: The name of the .so file to load.
    op_list: A list of names of operators that the library should have. If None
        then the .so file's contents will not be verified.

  Raises:
    NameError if one of the required ops is missing.
  """
  try:
    filename = resource_loader.get_path_to_datafile(name)
    library = load_library.load_op_library(filename)
    for expected_op in (op_list or []):
      for lib_op in library.OP_LIST.op:
        if lib_op.name == expected_op:
          break
      else:
        raise NameError('Could not find operator %s in dynamic library %s' %
                        (expected_op, name))
  except errors.NotFoundError:
    logging.warning('%s file could not be loaded.', name) 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:25,代碼來源:ffmpeg_ops.py

示例3: _load_library

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def _load_library(name, op_list=None):
    """Loads a .so file containing the specified operators.

    Args:
      name: The name of the .so file to load.
      op_list: A list of names of operators that the library should have. If None
          then the .so file's contents will not be verified.

    Raises:
      NameError if one of the required ops is missing.
      NotFoundError if were not able to load .so file.
    """
    filename = resource_loader.get_path_to_datafile(name)
    library = load_library.load_op_library(filename)
    for expected_op in (op_list or []):
        for lib_op in library.OP_LIST.op:
            if lib_op.name == expected_op:
                break
        else:
            raise NameError(
                'Could not find operator %s in dynamic library %s' %
                (expected_op, name))
    return library 
開發者ID:mlperf,項目名稱:training_results_v0.6,代碼行數:25,代碼來源:mpi_ops.py

示例4: Load

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def Load():
  """Load training ops library and return the loaded module."""
  with _ops_lock:
    global _training_ops
    if not _training_ops:
      ops_path = resource_loader.get_path_to_datafile(TRAINING_OPS_FILE)
      logging.info('data path: %s', ops_path)
      _training_ops = loader.load_op_library(ops_path)

      assert _training_ops, 'Could not load _training_ops.so'
  return _training_ops 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:13,代碼來源:training_ops.py

示例5: load_op_library

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def load_op_library(path):
  """Loads a contrib op library from the given path.

  NOTE(mrry): On Windows, we currently assume that some contrib op
  libraries are statically linked into the main TensorFlow Python
  extension DLL - use dynamically linked ops if the .so is present.

  Args:
    path: An absolute path to a shared object file.

  Returns:
    A Python module containing the Python wrappers for Ops defined in the
    plugin.
  """
  if os.name == 'nt':
    # To avoid makeing every user_ops aware of windows, re-write
    # the file extension from .so to .dll.
    path = re.sub(r'\.so$', '.dll', path)

    # Currently we have only some user_ops as dlls on windows - don't try
    # to load them if the dll is not found.
    # TODO(mrry): Once we have all of them this check should be removed.
    if not os.path.exists(path):
      return None
  path = resource_loader.get_path_to_datafile(path)
  ret = load_library.load_op_library(path)
  assert ret, 'Could not load %s' % path
  return ret 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:30,代碼來源:loader.py

示例6: zero_initializer

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def zero_initializer(ref, use_locking=True, name="zero_initializer"):
  """Initialize 'ref' with all zeros, ref tensor should be uninitialized.
  If already initialized, you will get ValueError. This op is intended to
  save memory during initialization.
  Args:
    ref: ref of the tensor need to be zero initialized.
    name: optional name for this operation.
  Returns:
    ref that initialized.
  Raises:
    ValueError: If ref tensor is initialized.
  """
  loader.load_op_library(
      resource_loader.get_path_to_datafile("_variable_ops.so"))
  return gen_variable_ops.zero_initializer(ref, name=name) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:17,代碼來源:variables.py

示例7: Load

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def Load():
  """Load training ops library and return the loaded module."""
  with _ops_lock:
    global _training_ops
    if not _training_ops:
      ops_path = resource_loader.get_path_to_datafile(TRAINING_OPS_FILE)
      logging.info('data path: %s', ops_path)
      _training_ops = load_library.load_op_library(ops_path)

      assert _training_ops, 'Could not load _training_ops.so'
  return _training_ops 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:13,代碼來源:training_ops.py

示例8: Load

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def Load():
  """Load the data ops library and return the loaded module."""
  with _ops_lock:
    global _data_ops
    if not _data_ops:
      ops_path = resource_loader.get_path_to_datafile(DATA_OPS_FILE)
      logging.info('data path: %s', ops_path)
      _data_ops = load_library.load_op_library(ops_path)

      assert _data_ops, 'Could not load _data_ops.so'
  return _data_ops 
開發者ID:tobegit3hub,項目名稱:deep_image_model,代碼行數:13,代碼來源:data_ops.py

示例9: Load

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def Load():
  """Load the inference ops library and return the loaded module."""
  with _ops_lock:
    global _inference_ops
    if not _inference_ops:
      ops_path = resource_loader.get_path_to_datafile(INFERENCE_OPS_FILE)
      logging.info('data path: %s', ops_path)
      _inference_ops = load_library.load_op_library(ops_path)

      assert _inference_ops, 'Could not load inference_ops.so'
  return _inference_ops 
開發者ID:tobegit3hub,項目名稱:deep_image_model,代碼行數:13,代碼來源:inference_ops.py

示例10: load_library

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def load_library(name):
    """Loads a .so file containing the specified operators.
    Args:
      name: The name of the .so file to load.
    Raises:
      NotFoundError if were not able to load .so file.
    """

    filename = resource_loader.get_path_to_datafile(name)
    library = _load_library.load_op_library(filename)
    return library 
開發者ID:NVIDIA,項目名稱:nvtx-plugins,代碼行數:13,代碼來源:ext_utils.py

示例11: testCreatePage

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def testCreatePage(self):
    num_clusters = 10
    clusters = np.random.random((num_clusters, 12, 14))
    template_src = resource_loader.get_path_to_datafile(
        'kmeans_labeler_template.html')
    template = mako_template.Template(open(template_src).read())
    html = kmeans_labeler_request_handler.create_page(clusters, template)
    self.assertEqual(len(re.findall('<img', html)), num_clusters)
    self.assertEqual(len(re.findall('<select', html)), num_clusters) 
開發者ID:tensorflow,項目名稱:moonlight,代碼行數:11,代碼來源:kmeans_labeler_request_handler_test.py

示例12: do_GET

# 需要導入模塊: from tensorflow.python.platform import resource_loader [as 別名]
# 或者: from tensorflow.python.platform.resource_loader import get_path_to_datafile [as 別名]
def do_GET(self):
    template_path = resource_loader.get_path_to_datafile(
        'kmeans_labeler_template.html')
    template = mako_template.Template(open(template_path).read())
    page = create_page(self.clusters, template)
    self.send_response(http_client.OK)
    self.send_header('Content-Type', 'text/html; charset=utf-8')
    self.end_headers()
    self.wfile.write(page) 
開發者ID:tensorflow,項目名稱:moonlight,代碼行數:11,代碼來源:kmeans_labeler_request_handler.py


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