Restrict visibility for micro libraries.

* testing library visible to all of micro but nothing else.
 * moved benchmark.h to micro/benchmarks so that it can have private visibility.

PiperOrigin-RevId: 315729400
Change-Id: I695b9bb749de8748e9ac929ff612d6a9e7d33b3d
This commit is contained in:
Advait Jain 2020-06-10 11:21:12 -07:00 committed by TensorFlower Gardener
parent 4acad672b7
commit 6e024748f6
5 changed files with 36 additions and 26 deletions

View File

@ -1,7 +1,16 @@
# Benchmarks for the ambient music detection model. licenses(["notice"]) # Apache 2.0
package( cc_library(
licenses = ["notice"], # Apache 2.0 name = "micro_benchmark",
hdrs = [
"micro_benchmark.h",
],
deps = [
"//tensorflow/lite/micro:micro_error_reporter",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro:micro_time",
"//tensorflow/lite/micro:op_resolvers",
],
) )
cc_binary( cc_binary(
@ -45,12 +54,12 @@ cc_binary(
srcs = ["keyword_benchmark.cc"], srcs = ["keyword_benchmark.cc"],
deps = [ deps = [
":keyword_scrambled_model_data", ":keyword_scrambled_model_data",
":micro_benchmark",
"//tensorflow/lite/c:common", "//tensorflow/lite/c:common",
"//tensorflow/lite/micro:micro_error_reporter", "//tensorflow/lite/micro:micro_error_reporter",
"//tensorflow/lite/micro:micro_framework", "//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro:op_resolvers", "//tensorflow/lite/micro:op_resolvers",
"//tensorflow/lite/micro/kernels:micro_ops", "//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/micro/testing:micro_benchmark",
], ],
) )
@ -58,6 +67,7 @@ cc_binary(
name = "person_detection_benchmark", name = "person_detection_benchmark",
srcs = ["person_detection_benchmark.cc"], srcs = ["person_detection_benchmark.cc"],
deps = [ deps = [
":micro_benchmark",
"//tensorflow/lite:schema_fbs_version", "//tensorflow/lite:schema_fbs_version",
"//tensorflow/lite/c:common", "//tensorflow/lite/c:common",
"//tensorflow/lite/micro:micro_error_reporter", "//tensorflow/lite/micro:micro_error_reporter",
@ -68,7 +78,6 @@ cc_binary(
"//tensorflow/lite/micro/examples/person_detection:person_detect_model_data", "//tensorflow/lite/micro/examples/person_detection:person_detect_model_data",
"//tensorflow/lite/micro/examples/person_detection:simple_images_test_data", "//tensorflow/lite/micro/examples/person_detection:simple_images_test_data",
"//tensorflow/lite/micro/kernels:micro_ops", "//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/micro/testing:micro_benchmark",
"//tensorflow/lite/schema:schema_fbs", "//tensorflow/lite/schema:schema_fbs",
], ],
) )

View File

@ -18,11 +18,11 @@ limitations under the License.
#include "tensorflow/lite/c/common.h" #include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.h" #include "tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.h"
#include "tensorflow/lite/micro/benchmarks/micro_benchmark.h"
#include "tensorflow/lite/micro/kernels/micro_ops.h" #include "tensorflow/lite/micro/kernels/micro_ops.h"
#include "tensorflow/lite/micro/micro_error_reporter.h" #include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h" #include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/micro/testing/micro_benchmark.h"
/* /*
* Keyword Spotting Benchmark for performance optimizations. The model used in * Keyword Spotting Benchmark for performance optimizations. The model used in

View File

@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==============================================================================*/ ==============================================================================*/
#ifndef TENSORFLOW_LITE_MICRO_TESTING_MICRO_BENCHMARK_H_ #ifndef TENSORFLOW_LITE_MICRO_BENCHMARKS_MICRO_BENCHMARK_H_
#define TENSORFLOW_LITE_MICRO_TESTING_MICRO_BENCHMARK_H_ #define TENSORFLOW_LITE_MICRO_BENCHMARKS_MICRO_BENCHMARK_H_
#include <climits> #include <climits>
@ -116,4 +116,4 @@ class MicroBenchmarkRunner {
tflite::MicroInterpreter interpreter_; tflite::MicroInterpreter interpreter_;
}; };
#endif // TENSORFLOW_LITE_MICRO_TESTING_MICRO_BENCHMARK_H_ #endif // TENSORFLOW_LITE_MICRO_BENCHMARKS_MICRO_BENCHMARK_H_

View File

@ -14,6 +14,7 @@ limitations under the License.
==============================================================================*/ ==============================================================================*/
#include "tensorflow/lite/c/common.h" #include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/micro/benchmarks/micro_benchmark.h"
#include "tensorflow/lite/micro/examples/person_detection/model_settings.h" #include "tensorflow/lite/micro/examples/person_detection/model_settings.h"
#include "tensorflow/lite/micro/examples/person_detection/no_person_image_data.h" #include "tensorflow/lite/micro/examples/person_detection/no_person_image_data.h"
#include "tensorflow/lite/micro/examples/person_detection/person_detect_model_data.h" #include "tensorflow/lite/micro/examples/person_detection/person_detect_model_data.h"
@ -23,7 +24,6 @@ limitations under the License.
#include "tensorflow/lite/micro/micro_interpreter.h" #include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/micro/micro_utils.h" #include "tensorflow/lite/micro/micro_utils.h"
#include "tensorflow/lite/micro/testing/micro_benchmark.h"
#include "tensorflow/lite/schema/schema_generated.h" #include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h" #include "tensorflow/lite/version.h"

View File

@ -3,9 +3,16 @@ load(
"tflite_micro_cc_test", "tflite_micro_cc_test",
) )
package( licenses(["notice"]) # Apache 2.0
default_visibility = ["//visibility:public"],
licenses = ["notice"], # Apache 2.0 package_group(
name = "micro",
packages = ["//tensorflow/lite/micro/..."],
)
package_group(
name = "microfrontend",
packages = ["//tensorflow/lite/experimental/microfrontend/..."],
) )
exports_files(["test_linux_binary.sh"]) exports_files(["test_linux_binary.sh"])
@ -19,6 +26,10 @@ cc_library(
"micro_test.h", "micro_test.h",
"test_utils.h", "test_utils.h",
], ],
visibility = [
":micro",
":microfrontend",
],
deps = [ deps = [
"//tensorflow/lite/c:common", "//tensorflow/lite/c:common",
"//tensorflow/lite/core/api", "//tensorflow/lite/core/api",
@ -39,19 +50,6 @@ tflite_micro_cc_test(
], ],
) )
cc_library(
name = "micro_benchmark",
hdrs = [
"micro_benchmark.h",
],
deps = [
"//tensorflow/lite/micro:micro_error_reporter",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro:micro_time",
"//tensorflow/lite/micro:op_resolvers",
],
)
cc_library( cc_library(
name = "test_conv_model", name = "test_conv_model",
srcs = [ srcs = [
@ -60,6 +58,9 @@ cc_library(
hdrs = [ hdrs = [
"test_conv_model.h", "test_conv_model.h",
], ],
visibility = [
":micro",
],
) )
py_binary( py_binary(