tensorflow serving目錄解讀
|
-----tensorflow-serving/----BUILD
| |
| -----workspace.bzl
| |
| -----example/-------BUILD
| |
| --------imagenet_lsvrc_2015_synsets.txt
| |
| --------imagenet_metadata.txt
| |
| --------inception_client.cc
| |
| --------inception_client.py
| |
| --------inception_k8s.yaml
| |
| --------inception_saved_model.py
| |
| --------mnist_client.py
| |
| --------mnist_iput_data.py
| |
| --------mnist_saved_model.py
|
-----------tensorflow/-------BUILD
| |
| --------WORKSPACE
| |
| ----tensorflow/------BUILD
| |
| -------workspace.bzl
|
-----------tf_models/----WORKSPACE
|
-----official/
|
-----tutorials/
|
-----research/-------inception/-------------------WORKSPACE
|
-------------------inception/--------BUILD
|
---------inception_train.py
|
---------inception_model.py
|
---------inception_eval.py
|
---------inception_distributed_train.py
解讀:
項目文件夾名稱為"tf_serving",WORKSPACE文件放在"tf_serving"項目文件夾的根目錄
*************************************************************************
tf_serving/WORKSPACE解讀:
*************************************************************************
#聲明工作空間名稱,與項目名稱一致 workspace(name = "tf_serving") #聲明本地倉庫'tensorflow'的名稱及路徑 local_repository(name = "org_tensorflow", path = "tensorflow",) #聲明io_bazel_rules_closure http_archive(……) #把新的Tensorflow Serving依賴加到workspace.bzl load("//tensorflow_serving:workspace.bzl","tf_serving_workspace") tf_serving_workspace() #指定bazel最低要求版本 load("@org_tensorflow//tensorflow::workspace.bzl", "check_version") check_version("0.5.4")
*************************************************************************
tf_serving/tensorflow_serving/workspace.bzl解讀:
*************************************************************************
#tensorFlow Serving外部依賴加載到WORKSPACE文件 load('@org_tensorflow//tensorflow::workspace.bzl', 'tf_workspace') #此處是所有Tensorflow Serving的外部依賴。 #workspace_dir是Tensorflow Serving repo的絕對路徑,如果是作為submodule #連接,路徑形式應該是'__workspace_dir__ + "serving"' def tf_serving_workspace(): native.new_local_repository( name = "inception_model", path = "tf_models/research/inception", build_file = "tf_models/research/inception/inception/BUILD", ) tf_workspace(path_prefix = "", tf_repo_name = "org_tensorflow") #gRPC依賴 native.bind( name = "libssl", actual = "@boringssl//:ssl", ) native.bind( name = "zlib", actual = "@zlib_archive//:zlib")
*************************************************************************
tf_serving/tensorflow_serving/BUILD解讀:
*************************************************************************
# Tensorflow serving描述 package( default_visibility=["//tensorflow_serving:internal"], ) licenses(["notice"]) exports_files(["LICENSE"]) #開放源代碼標記 package_group( name = "internal", package = [ "//tensorflow_serving/...", ], ) filegroup( name = "all_files", srcs = glob( ["**/*"], exclude = [ "**/METADATA", "**/OWNERS", "g3doc/sitemap.md", ], ), )
*************************************************************************
tf_serving/tensorflow/tensorflow/workspace.bzl解讀:
*************************************************************************
# 可以在WORKSPACE文件中加載的Tensorflow外部依賴 load(……) def _is_windows(): …… def _get_env_var(): …… # 從'native.bazel_version'中解析bazel版本字符串 def _parse_bazel_version(): …… # 檢查正在使用指定版本的bazel def check_version(): …… # 支持將Tensorflow作為submodule的臨時工作區 def _temp_workaround_http_archive_impl(): …… # 如果非零code退出,則執行指定參數的命令並調用'fail' def _execute_and_check_ret_code(): …… # 在倉庫根目錄應用補丁文件 def _apply_patch(): …… # 下載倉庫,在根節點應用補丁 def _patched_http_archive_impl(): …… # 如果Tensorflow連接為submodule,path_prefix不再使用 # tf_repo_name正在考慮中 def tf_workspace(): ……
*************************************************************************
tf_serving/tensorflow/tensorflow/BUILD解讀:
*************************************************************************
package(default_visibility = [":internal"]) licenses(["notice"]) exports_files([ "LICENSE", "ACKNOWLEDGMENTS", # leakr文件用於//third_party/cloud_tpu "leakr_badwords.dic", "leakr_badfiles.dic", ]) load("//tensorflow:tensorflow.bzl", "tf_cc_shared_object") load("//tensorflow/core:platform/default/build_config.bzl", "tf_additional_binary_deps", ) # 各種config setting config_setting() package_group() filegroup() py_library() filegroup( name = "all_opensource_files", data = [ ":all_files", "//tensorflow/c:all_files", "//tensorflow/cc:all_files", ……], visibility = [':__subpackages__'], ) load("//third_party/mkl:build_defs.bzl", "if_mkl", ) filegroup( name = "intel_binary_blob", data = if_mkl( [ "//third_party/mkl:intel_binary_blob", ], ), ) filegroup( name = "docs_src", data = glob(["docs_src/**/*.md"]), ) tf_cc_shared_object( …… )
tensorflow serving目錄解讀