Merged commit includes the following changes:

269734643  by A. Unique TensorFlower<gardener@tensorflow.org>:
    Automated rollback of changelist 269726613.

269731545  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Internal changes

--
269727997  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Refactor evaluation tools

--
269727962  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Build TFLite iOS framework with select TF ops using bazel

--
269726613  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Internal change

PiperOrigin-RevId: 269734643
This commit is contained in:
A. Unique TensorFlower 2019-09-17 23:21:24 -07:00 committed by TensorFlower Gardener
parent d30ba84437
commit 32aaaec4c9
14 changed files with 107 additions and 36 deletions

View File

@ -19,6 +19,20 @@ build:android_x86_64 --fat_apk_cpu=x86_64
# Sets the default Apple platform to macOS.
build --apple_platform_type=macos
# iOS configs for each architecture and the fat binary builds.
build:ios --apple_platform_type=ios
build:ios --apple_bitcode=embedded --copt=-fembed-bitcode
build:ios_armv7 --config=ios
build:ios_armv7 --cpu=ios_armv7
build:ios_armv7 --cops -Wno-c++11-narrowing
build:ios_arm64 --config=ios
build:ios_arm64 --cpu=ios_arm64
build:ios_x86_64 --config=ios
build:ios_x86_64 --cpu=ios_x86_64
build:ios_fat --config=ios
build:ios_fat --ios_multi_cpus=armv7,arm64
build:ios_fat --copt -Wno-c++11-narrowing
# Config to use a mostly-static build and disable modular op registration
# support (this will revert to loading TensorFlow with RTLD_GLOBAL in Python).
# By default, TensorFlow will build with a dependence on

View File

@ -210,7 +210,7 @@ class PosixEnv : public Env {
} // namespace
#if defined(PLATFORM_POSIX) || defined(__ANDROID__)
#if defined(PLATFORM_POSIX) || defined(__APPLE__) || defined(__ANDROID__)
REGISTER_FILE_SYSTEM("", PosixFileSystem);
REGISTER_FILE_SYSTEM("file", LocalPosixFileSystem);
Env* Env::Default() {

View File

@ -21,8 +21,9 @@ limitations under the License.
// Include appropriate platform-dependent implementation.
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/dynamic_annotations.h"
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_WINDOWS)
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \
defined(PLATFORM_GOOGLE_IOS) || defined(PLATFORM_WINDOWS)
#include "tensorflow/core/platform/default/dynamic_annotations.h"
#else
#error Define the appropriate PLATFORM_<foo> macro for this platform

View File

@ -28,8 +28,9 @@ limitations under the License.
// Include appropriate platform-dependent implementation details of mutex etc.
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/mutex_data.h"
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_WINDOWS)
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \
defined(PLATFORM_GOOGLE_IOS) || defined(PLATFORM_WINDOWS)
#include "tensorflow/core/platform/default/mutex_data.h"
#else
#error Define the appropriate PLATFORM_<foo> macro for this platform
@ -301,8 +302,9 @@ inline Condition::Condition(const bool* flag)
// Include appropriate platform-dependent implementation details of mutex etc.
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/mutex.h"
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_WINDOWS)
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \
defined(PLATFORM_GOOGLE_IOS) || defined(PLATFORM_WINDOWS)
#include "tensorflow/core/platform/default/mutex.h"
#else
#error Define the appropriate PLATFORM_<foo> macro for this platform

View File

@ -21,8 +21,9 @@ limitations under the License.
// Include appropriate platform-dependent implementations of Notification.
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/notification.h"
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_WINDOWS)
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \
defined(PLATFORM_GOOGLE_IOS) || defined(PLATFORM_WINDOWS)
#include "tensorflow/core/platform/default/notification.h"
#else
#error Define the appropriate PLATFORM_<foo> macro for this platform

View File

@ -29,12 +29,12 @@ limitations under the License.
#define IS_MOBILE_PLATFORM
#elif defined(__APPLE__)
#define PLATFORM_POSIX
#include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR
#define IS_MOBILE_PLATFORM
#elif TARGET_OS_IPHONE
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
#define PLATFORM_POSIX_IOS
#define IS_MOBILE_PLATFORM
#else
#define PLATFORM_POSIX
#endif
#elif defined(_WIN32)

View File

@ -21,8 +21,9 @@ limitations under the License.
// Include appropriate platform-dependent implementation.
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/stacktrace.h"
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID)
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \
defined(PLATFORM_GOOGLE_IOS)
#include "tensorflow/core/platform/default/stacktrace.h"
#elif defined(PLATFORM_WINDOWS)
#include "tensorflow/core/platform/windows/stacktrace.h"

View File

@ -60,8 +60,9 @@ std::unique_ptr<SubProcess> CreateSubProcess(const std::vector<string>& argv);
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/subprocess.h"
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID)
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \
defined(PLATFORM_GOOGLE_IOS)
#include "tensorflow/core/platform/default/subprocess.h"
#elif defined(PLATFORM_WINDOWS)
#include "tensorflow/core/platform/windows/subprocess.h"

View File

@ -26,8 +26,9 @@ limitations under the License.
#include "tensorflow/core/platform/google/integral_types.h"
#elif defined(PLATFORM_WINDOWS)
#include "tensorflow/core/platform/windows/integral_types.h"
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID)
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \
defined(PLATFORM_GOOGLE_IOS)
#include "tensorflow/core/platform/default/integral_types.h"
#else
#error Define the appropriate PLATFORM_<foo> macro for this platform

View File

@ -23,8 +23,9 @@ limitations under the License.
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/unbounded_work_queue.h"
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_WINDOWS)
#elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \
defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \
defined(PLATFORM_GOOGLE_IOS) || defined(PLATFORM_WINDOWS)
#include "tensorflow/core/platform/default/unbounded_work_queue.h"
#else
#error Define the appropriate PLATFORM_<foo> macro for this platform

View File

@ -24,6 +24,9 @@ cc_library(
"//tensorflow:android": [
"//tensorflow/core:android_tensorflow_lib_lite",
],
"//tensorflow:ios": [
"//tensorflow/core:ios_tensorflow_lib_lite",
],
"//conditions:default": [
"//tensorflow/c:c_api_internal",
"//tensorflow/core:framework",
@ -61,6 +64,9 @@ cc_library(
"//tensorflow:android": [
"//tensorflow/core:android_tensorflow_lib",
],
"//tensorflow:ios": [
"//tensorflow/core:ios_tensorflow_lib",
],
"//conditions:default": [
"//tensorflow/core:tensorflow",
"//tensorflow/lite/c:c_api_internal",
@ -95,6 +101,9 @@ cc_library(
"//tensorflow:android": [
"//tensorflow/core:android_tensorflow_lib_lite",
],
"//tensorflow:ios": [
"//tensorflow/core:ios_tensorflow_lib_lite",
],
"//conditions:default": [
"//tensorflow/core:lib",
],
@ -126,6 +135,9 @@ cc_library(
"//tensorflow:android": [
"//tensorflow/core:android_tensorflow_lib_lite",
],
"//tensorflow:ios": [
"//tensorflow/core:ios_tensorflow_lib_lite",
],
"//conditions:default": [
"//tensorflow/core/common_runtime/eager:context",
"//tensorflow/core:core_cpu",
@ -168,6 +180,9 @@ cc_library(
"//tensorflow:android": [
"//tensorflow/core:android_tensorflow_lib_lite",
],
"//tensorflow:ios": [
"//tensorflow/core:ios_tensorflow_lib_lite",
],
"//conditions:default": [
"//tensorflow/core/common_runtime/eager:context",
"//tensorflow/core/common_runtime/eager:execute",
@ -193,6 +208,9 @@ tf_cc_test(
"//tensorflow:android": [
"//tensorflow/core:android_tensorflow_lib",
],
"//tensorflow:ios": [
"//tensorflow/core:ios_tensorflow_lib",
],
"//conditions:default": [
"//tensorflow/core:tensorflow",
],
@ -224,6 +242,9 @@ cc_library(
"//tensorflow:android": [
"//tensorflow/core:android_tensorflow_lib_lite",
],
"//tensorflow:ios": [
"//tensorflow/core:ios_tensorflow_lib_lite",
],
"//conditions:default": [
"//tensorflow/c:c_api_internal",
"//tensorflow/core:lib",

View File

@ -8,13 +8,18 @@ package(
licenses = ["notice"], # Apache 2.0
)
TFL_LIBRARY_HDRS = [
"//tensorflow/lite/delegates/gpu:metal_delegate.h",
"//tensorflow/lite/experimental/c:c_api.h",
]
TFL_FRAMEWORK_HDRS = TFL_LIBRARY_HDRS + [
"//tensorflow/lite/experimental/c:c_api_types.h",
]
ios_static_framework(
name = "TensorFlowLiteC_framework",
hdrs = [
"//tensorflow/lite/delegates/gpu:metal_delegate.h",
"//tensorflow/lite/experimental/c:c_api.h",
"//tensorflow/lite/experimental/c:c_api_types.h",
],
hdrs = TFL_FRAMEWORK_HDRS,
bundle_name = "TensorFlowLiteC",
minimum_os_version = TFL_MINIMUM_OS_VERSION,
deps = [
@ -22,16 +27,43 @@ ios_static_framework(
],
)
ios_static_framework(
name = "TensorFlowLiteCWithSelectTfOps_framework",
hdrs = TFL_FRAMEWORK_HDRS,
bundle_name = "TensorFlowLiteC",
minimum_os_version = TFL_MINIMUM_OS_VERSION,
deps = [
":TensorFlowLiteC",
"//tensorflow/lite/delegates/flex:delegate",
],
)
objc_library(
name = "TensorFlowLiteC",
hdrs = [
"//tensorflow/lite/delegates/gpu:metal_delegate.h",
"//tensorflow/lite/experimental/c:c_api.h",
],
hdrs = TFL_LIBRARY_HDRS,
module_name = "TensorFlowLiteC",
weak_sdk_frameworks = [
"Metal",
],
deps = [
":tensorflow_lite_c",
],
)
# Using this intermediate target is a workaround for a bug in bazel build rules
# involving mixed objc_library & cc_library deps mentioned in (b/74809458).
# When these dependencies are declared directly under the "TensorFlowLiteC"
# target above, the resulting static library incorrectly contains duplicate
# symbols from some ObjC code in the transitive dependencies.
#
# When a new dependency should be added to the TensorFlowLiteC framework, the
# dependency should be added under this target instead.
# When a new header file needs to be exposed, the header should be added to the
# TFL_LIBRARY_HDRS list above.
cc_library(
name = "tensorflow_lite_c",
hdrs = TFL_LIBRARY_HDRS,
tags = ["nobuilder"],
deps = [
"//tensorflow/lite/delegates/gpu:metal_delegate",
"//tensorflow/lite/experimental/c:c_api",

View File

@ -197,10 +197,8 @@ for configuring NDK and SDK.
```
bazel build -c opt \
--config=android_arm \
--config=android_arm64 \
--cxxopt='--std=c++11' \
--copt=-D__ANDROID_TYPES_FULL__ \
--copt=-DSUPPORT_SELECTIVE_REGISTRATION \
//tensorflow/lite/tools/evaluation/tasks/coco_object_detection:run_eval
```

View File

@ -142,10 +142,8 @@ for configuring NDK and SDK.
```
bazel build -c opt \
--config=android_arm \
--config=android_arm64 \
--cxxopt='--std=c++11' \
--copt=-D__ANDROID_TYPES_FULL__ \
--copt=-DSUPPORT_SELECTIVE_REGISTRATION \
//tensorflow/lite/tools/evaluation/tasks/imagenet_image_classification:run_eval
```