Migrate TFLite iOS directories out of experimental

PiperOrigin-RevId: 343958075
Change-Id: I4c7736094f1babab288fb57455e29ab4c0c4fa3d
This commit is contained in:
YoungSeok Yoon 2020-11-23 17:14:56 -08:00 committed by TensorFlower Gardener
parent 5a086ba4f1
commit 5a063c275e
85 changed files with 105 additions and 104 deletions

View File

@ -55,16 +55,16 @@ NCCL_LIB_PATHS = [
# List of files to configure when building Bazel on Apple platforms.
APPLE_BAZEL_FILES = [
'tensorflow/lite/experimental/ios/BUILD',
'tensorflow/lite/experimental/objc/BUILD',
'tensorflow/lite/experimental/swift/BUILD',
'tensorflow/lite/ios/BUILD',
'tensorflow/lite/objc/BUILD',
'tensorflow/lite/swift/BUILD',
'tensorflow/lite/tools/benchmark/experimental/ios/BUILD'
]
# List of files to move when building for iOS.
IOS_FILES = [
'tensorflow/lite/experimental/objc/TensorFlowLiteObjC.podspec',
'tensorflow/lite/experimental/swift/TensorFlowLiteSwift.podspec',
'tensorflow/lite/objc/TensorFlowLiteObjC.podspec',
'tensorflow/lite/swift/TensorFlowLiteSwift.podspec',
]

View File

@ -54,15 +54,15 @@ Once Bazel is properly configured with iOS support, you can build the
```sh
bazel build --config=ios_fat -c opt \
//tensorflow/lite/experimental/ios:TensorFlowLiteC_framework
//tensorflow/lite/ios:TensorFlowLiteC_framework
```
This command will generate the `TensorFlowLiteC_framework.zip` file under
`bazel-bin/tensorflow/lite/experimental/ios/` directory under your TensorFlow
root directory. By default, the generated framework contains a "fat" binary,
containing armv7, arm64, and x86_64 (but no i386). To see the full list of build
flags used when you specify `--config=ios_fat`, please refer to the iOS configs
section in the [`.bazelrc` file][bazelrc].
`bazel-bin/tensorflow/lite/ios/` directory under your TensorFlow root directory.
By default, the generated framework contains a "fat" binary, containing armv7,
arm64, and x86_64 (but no i386). To see the full list of build flags used when
you specify `--config=ios_fat`, please refer to the iOS configs section in the
[`.bazelrc` file][bazelrc].
## Use in your own application
@ -147,7 +147,7 @@ For Swift:
```python
swift_library(
deps = [
"//tensorflow/lite/experimental/swift:TensorFlowLite",
"//tensorflow/lite/swift:TensorFlowLite",
],
)
```
@ -157,7 +157,7 @@ For Objective-C:
```python
objc_library(
deps = [
"//tensorflow/lite/experimental/objc:TensorFlowLite",
"//tensorflow/lite/objc:TensorFlowLite",
],
)
```
@ -200,7 +200,7 @@ TensorFlow Lite's C API, defined by the header files under
[bazel-install]: https://docs.bazel.build/versions/master/install-os-x.html
[bazelrc]: https://github.com/tensorflow/tensorflow/blob/master/.bazelrc
[configure-py]: https://github.com/tensorflow/tensorflow/blob/master/configure.py
[objc-api]: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/objc
[objc-api]: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/objc
[private-cocoapods]: https://guides.cocoapods.org/making/private-cocoapods.html
[swift-api]: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/swift
[tflite-podspec]: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/ios/TensorFlowLiteC.podspec
[swift-api]: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/swift
[tflite-podspec]: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/ios/TensorFlowLiteC.podspec

View File

@ -85,9 +85,9 @@ information, please refer to the
### iOS Platform
On iOS, TensorFlow Lite is available with native iOS libraries written in
[Swift](https://www.tensorflow.org/code/tensorflow/lite/experimental/swift)
[Swift](https://www.tensorflow.org/code/tensorflow/lite/swift)
and
[Objective-C](https://www.tensorflow.org/code/tensorflow/lite/experimental/objc).
[Objective-C](https://www.tensorflow.org/code/tensorflow/lite/objc).
You can also use
[C API](https://www.tensorflow.org/code/tensorflow/lite/c/c_api.h)
directly in Objective-C codes.
@ -238,7 +238,7 @@ Java inference API, but planned extensions will make this possible.
*Platform: iOS*
The
[Swift API](https://www.tensorflow.org/code/tensorflow/lite/experimental/swift)
[Swift API](https://www.tensorflow.org/code/tensorflow/lite/swift)
is available in `TensorFlowLiteSwift` Pod from Cocoapods.
First, you need to import `TensorFlowLite` module.
@ -292,7 +292,7 @@ do {
*Platform: iOS*
The
[Objective-C API](https://www.tensorflow.org/code/tensorflow/lite/experimental/objc)
[Objective-C API](https://www.tensorflow.org/code/tensorflow/lite/objc)
is available in `TensorFlowLiteObjC` Pod from Cocoapods.
First, you need to import `TensorFlowLite` module.

View File

@ -23,10 +23,11 @@ use cases are available in [Examples](https://www.tensorflow.org/lite/examples).
## Add TensorFlow Lite to your Swift or Objective-C project
TensorFlow Lite offers native iOS libraries written in
[Swift](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/swift)
[Swift](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/swift)
and
[Objective-C](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/objc).
Start writing your own iOS code using the [Swift image classification example](https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/ios)
[Objective-C](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/objc).
Start writing your own iOS code using the
[Swift image classification example](https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/ios)
as a starting point.
The sections below demonstrate how to add TensorFlow Lite Swift or Objective-C
@ -99,7 +100,7 @@ In your `BUILD` file, add the `TensorFlowLite` dependency to your target.
```python
swift_library(
deps = [
"//tensorflow/lite/experimental/swift:TensorFlowLite",
"//tensorflow/lite/swift:TensorFlowLite",
],
)
```
@ -109,7 +110,7 @@ swift_library(
```python
objc_library(
deps = [
"//tensorflow/lite/experimental/objc:TensorFlowLite",
"//tensorflow/lite/objc:TensorFlowLite",
],
)
```

View File

@ -174,12 +174,12 @@ provide the list of target architectures excluding `i386`.
```sh
bazel build -c opt --config=ios --ios_multi_cpus=armv7,arm64,x86_64 \
//tensorflow/lite/experimental/ios:TensorFlowLiteSelectTfOps_framework
//tensorflow/lite/ios:TensorFlowLiteSelectTfOps_framework
```
This will generate the framework under
`bazel-bin/tensorflow/lite/experimental/ios/` directory. You can add this new
framework to your Xcode project by following similar steps described under the
This will generate the framework under `bazel-bin/tensorflow/lite/ios/`
directory. You can add this new framework to your Xcode project by following
similar steps described under the
[Xcode project settings](./build_ios.md#modify_xcode_project_settings_directly)
section in the iOS build guide.

View File

@ -247,6 +247,6 @@ issue with all the necessary details to reproduce.
## APIs
* [Core ML delegate Swift API](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/swift/Sources/CoreMLDelegate.swift)
* [Core ML delegate Swift API](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/swift/Sources/CoreMLDelegate.swift)
* [Core ML delegate C API](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/delegates/coreml/coreml_delegate.h)
* This can be used for Objective-C codes.

View File

@ -247,7 +247,7 @@ called.
`TFLGpuDelegateCreate()` accepts a `struct` of options.
([C API](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/delegates/gpu/metal_delegate.h),
[Swift API](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/swift/Sources/MetalDelegate.swift))
[Swift API](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/swift/Sources/MetalDelegate.swift))
Passing `nullptr`(C API) or nothing (Swift API) to the initializer sets the
default options (which are explicated in the Basic Usage example above).

View File

@ -2,7 +2,7 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load(
"//tensorflow/lite/experimental/ios:ios.bzl",
"//tensorflow/lite/ios:ios.bzl",
"TFL_MINIMUM_OS_VERSION",
"strip_common_include_path_prefix",
"tflite_ios_static_framework",
@ -44,7 +44,7 @@ strip_common_include_path_prefix(
prefix = "TensorFlowLiteC/",
)
# bazel build -c opt --config=ios_fat //tensorflow/lite/experimental/ios:TensorFlowLiteC_framework
# bazel build -c opt --config=ios_fat //tensorflow/lite/ios:TensorFlowLiteC_framework
tflite_ios_static_framework(
name = "TensorFlowLiteC_framework",
hdrs = [
@ -68,7 +68,7 @@ tflite_ios_static_framework(
# The flex delegate cannot be built for i386, so it can't be built with ios_fat
# config.
#
# bazel build -c opt --config=ios --ios_multi_cpus=armv7,arm64,x86_64 //tensorflow/lite/experimental/ios:TensorFlowLiteSelectTfOps_framework
# bazel build -c opt --config=ios --ios_multi_cpus=armv7,arm64,x86_64 //tensorflow/lite/ios:TensorFlowLiteSelectTfOps_framework
ios_static_framework(
name = "TensorFlowLiteSelectTfOps_framework",
avoid_deps = ["//tensorflow/lite/c:common"],
@ -84,7 +84,7 @@ ios_static_framework(
# TensorFlow Lite runtime, it is intended to be linked along with the
# TensorFlowLiteC framework above in a composable way.
#
# bazel build -c opt --config=ios_fat //tensorflow/lite/experimental/ios:TensorFlowLiteCCoreML_framework
# bazel build -c opt --config=ios_fat //tensorflow/lite/ios:TensorFlowLiteCCoreML_framework
tflite_ios_static_framework(
name = "TensorFlowLiteCCoreML_framework",
hdrs = [
@ -103,7 +103,7 @@ tflite_ios_static_framework(
# TensorFlow Lite runtime, it is intended to be linked along with the
# TensorFlowLiteC framework above in a composable way.
#
# bazel build -c opt --config=ios_fat //tensorflow/lite/experimental/ios:TensorFlowLiteCMetal_framework
# bazel build -c opt --config=ios_fat //tensorflow/lite/ios:TensorFlowLiteCMetal_framework
tflite_ios_static_framework(
name = "TensorFlowLiteCMetal_framework",
hdrs = [

View File

@ -1,7 +1,7 @@
# TensorFlow Lite for iOS
- For Swift developers, add the `TensorFlowLiteSwift` pod to your Podfile. For
Objective-C developers, add `TensorFlowLiteObjC`. See the TensorFlow Lite
[Swift](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/swift)
[Swift](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/swift)
and
[ObjC](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/objc)
[ObjC](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/objc)
directories for more details.

View File

@ -60,7 +60,7 @@ def tflite_ios_static_framework(
"BUNDLE_NAME=\"" + bundle_name + "\" " +
"ALLOWLIST_FILE_PATH=\"$(location " + allowlist_symbols_file + ")\" " +
"OUTPUT=\"$(OUTS)\" " +
"\"$(location //tensorflow/lite/experimental/ios:hide_symbols_with_allowlist)\"")
"\"$(location //tensorflow/lite/ios:hide_symbols_with_allowlist)\"")
native.genrule(
name = name,
@ -68,7 +68,7 @@ def tflite_ios_static_framework(
outs = [name + ".zip"],
cmd = cmd,
tools = [
"//tensorflow/lite/experimental/ios:hide_symbols_with_allowlist",
"//tensorflow/lite/ios:hide_symbols_with_allowlist",
],
)

View File

@ -1,7 +1,7 @@
# TensorFlow Lite for Objective-C
load("//tensorflow/lite:special_rules.bzl", "ios_visibility_whitelist", "tflite_ios_lab_runner")
load("//tensorflow/lite/experimental/ios:ios.bzl", "TFL_DEFAULT_TAGS", "TFL_DISABLED_SANITIZER_TAGS", "TFL_MINIMUM_OS_VERSION")
load("//tensorflow/lite/ios:ios.bzl", "TFL_DEFAULT_TAGS", "TFL_DISABLED_SANITIZER_TAGS", "TFL_MINIMUM_OS_VERSION")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test")
package(

View File

@ -51,7 +51,7 @@ In your `BUILD` file, add the `TensorFlowLite` dependency to your target:
```python
objc_library(
deps = [
"//tensorflow/lite/experimental/objc:TensorFlowLite",
"//tensorflow/lite/objc:TensorFlowLite",
],
)
```
@ -71,23 +71,23 @@ Or, the module if you set `CLANG_ENABLE_MODULES = YES` in your Xcode project:
Build the `TensorFlowLite` Objective-C library target:
```shell
bazel build tensorflow/lite/experimental/objc:TensorFlowLite
bazel build tensorflow/lite/objc:TensorFlowLite
```
Build the `Tests` target:
```shell
bazel test tensorflow/lite/experimental/objc:Tests
bazel test tensorflow/lite/objc:Tests
```
#### Generate the Xcode project using Tulsi
Open the `//tensorflow/lite/experimental/objc/TensorFlowLite.tulsiproj` using
Open the `//tensorflow/lite/objc/TensorFlowLite.tulsiproj` using
the [TulsiApp](https://github.com/bazelbuild/tulsi)
or by running the
[`generate_xcodeproj.sh`](https://github.com/bazelbuild/tulsi/blob/master/src/tools/generate_xcodeproj.sh)
script from the root `tensorflow` directory:
```shell
generate_xcodeproj.sh --genconfig tensorflow/lite/experimental/objc/TensorFlowLite.tulsiproj:TensorFlowLite --outputfolder ~/path/to/generated/TensorFlowLite.xcodeproj
generate_xcodeproj.sh --genconfig tensorflow/lite/objc/TensorFlowLite.tulsiproj:TensorFlowLite --outputfolder ~/path/to/generated/TensorFlowLite.xcodeproj
```

View File

@ -2,21 +2,21 @@
"sourceFilters" : [
"tensorflow/lite",
"tensorflow/lite/c",
"tensorflow/lite/experimental/objc",
"tensorflow/lite/experimental/objc/apis",
"tensorflow/lite/experimental/objc/apps/TestApp/TestApp",
"tensorflow/lite/experimental/objc/apps/TestApp/TestApp/Base.lproj",
"tensorflow/lite/experimental/objc/sources",
"tensorflow/lite/experimental/objc/tests",
"tensorflow/lite/objc",
"tensorflow/lite/objc/apis",
"tensorflow/lite/objc/apps/TestApp/TestApp",
"tensorflow/lite/objc/apps/TestApp/TestApp/Base.lproj",
"tensorflow/lite/objc/sources",
"tensorflow/lite/objc/tests",
"tensorflow/lite/kernels",
"tensorflow/lite/kernels/internal",
"tensorflow/lite/nnapi",
"tensorflow/lite/schema",
"tensorflow/lite/schema"
],
"buildTargets" : [
"//tensorflow/lite/experimental/objc:TensorFlowLite",
"//tensorflow/lite/experimental/objc:TestApp",
"//tensorflow/lite/experimental/objc:Tests",
"//tensorflow/lite/objc:TensorFlowLite",
"//tensorflow/lite/objc:TestApp",
"//tensorflow/lite/objc:Tests"
],
"projectName" : "TensorFlowLite",
"optionSet" : {
@ -58,6 +58,6 @@
}
},
"additionalFilePaths" : [
"tensorflow/lite/experimental/objc/BUILD",
"tensorflow/lite/objc/BUILD"
]
}

View File

@ -11,7 +11,7 @@
},
"projectName" : "TensorFlowLite",
"packages" : [
"tensorflow/lite/experimental/objc"
"tensorflow/lite/objc"
],
"workspaceRoot" : "../../../../.."
"workspaceRoot" : "../../../.."
}

View File

@ -20,7 +20,7 @@ Pod::Spec.new do |s|
s.static_framework = true
tfl_dir = 'tensorflow/lite/'
objc_dir = tfl_dir + 'experimental/objc/'
objc_dir = tfl_dir + 'objc/'
s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' =>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLCoreMLDelegate.h"
#import "tensorflow/lite/objc/apis/TFLCoreMLDelegate.h"
#ifdef COCOAPODS
@import TensorFlowLiteCCoreML;

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLDelegate.h"
#import "tensorflow/lite/objc/apis/TFLDelegate.h"
NS_ASSUME_NONNULL_BEGIN

View File

@ -14,7 +14,7 @@
#import <Foundation/Foundation.h>
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreter.h"
#import "tensorflow/lite/objc/apis/TFLInterpreter.h"
NS_ASSUME_NONNULL_BEGIN

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreter.h"
#import "tensorflow/lite/objc/apis/TFLInterpreter.h"
@class TFLTensor;

View File

@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreter.h"
#import "tensorflow/lite/objc/apis/TFLInterpreter.h"
#include <vector>
#import "TFLErrorUtil.h"
#import "TFLQuantizationParameters+Internal.h"
#import "TFLTensor+Internal.h"
#import "tensorflow/lite/experimental/objc/apis/TFLDelegate.h"
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreterOptions.h"
#import "tensorflow/lite/experimental/objc/apis/TFLTensor.h"
#import "tensorflow/lite/objc/apis/TFLDelegate.h"
#import "tensorflow/lite/objc/apis/TFLInterpreterOptions.h"
#import "tensorflow/lite/objc/apis/TFLTensor.h"
#include "tensorflow/lite/c/c_api.h"
#include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreterOptions.h"
#import "tensorflow/lite/objc/apis/TFLInterpreterOptions.h"
NS_ASSUME_NONNULL_BEGIN

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLMetalDelegate.h"
#import "tensorflow/lite/objc/apis/TFLMetalDelegate.h"
#ifdef COCOAPODS
@import TensorFlowLiteCMetal;

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLQuantizationParameters.h"
#import "tensorflow/lite/objc/apis/TFLQuantizationParameters.h"
NS_ASSUME_NONNULL_BEGIN

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLQuantizationParameters.h"
#import "tensorflow/lite/objc/apis/TFLQuantizationParameters.h"
#import "TFLQuantizationParameters+Internal.h"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLTensor.h"
#import "tensorflow/lite/objc/apis/TFLTensor.h"
@class TFLInterpreter;

View File

@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLTensor.h"
#import "tensorflow/lite/objc/apis/TFLTensor.h"
#import "TFLErrorUtil.h"
#import "TFLInterpreter+Internal.h"
#import "TFLTensor+Internal.h"
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreter.h"
#import "tensorflow/lite/objc/apis/TFLInterpreter.h"
NS_ASSUME_NONNULL_BEGIN

View File

@ -15,8 +15,8 @@
#ifdef COCOAPODS
@import TFLTensorFlowLite;
#else
#import "tensorflow/lite/experimental/objc/apis/TFLCoreMLDelegate.h"
#import "tensorflow/lite/experimental/objc/apis/TFLTensorFlowLite.h"
#import "tensorflow/lite/objc/apis/TFLCoreMLDelegate.h"
#import "tensorflow/lite/objc/apis/TFLTensorFlowLite.h"
#endif
#import <XCTest/XCTest.h>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreterOptions.h"
#import "tensorflow/lite/objc/apis/TFLInterpreterOptions.h"
#import <XCTest/XCTest.h>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLTensorFlowLite.h"
#import "tensorflow/lite/objc/apis/TFLTensorFlowLite.h"
#import <XCTest/XCTest.h>

View File

@ -15,8 +15,8 @@
#ifdef COCOAPODS
@import TFLTensorFlowLite;
#else
#import "tensorflow/lite/experimental/objc/apis/TFLMetalDelegate.h"
#import "tensorflow/lite/experimental/objc/apis/TFLTensorFlowLite.h"
#import "tensorflow/lite/objc/apis/TFLMetalDelegate.h"
#import "tensorflow/lite/objc/apis/TFLTensorFlowLite.h"
#endif
#import <Metal/MTLDevice.h>

View File

@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "tensorflow/lite/experimental/objc/apis/TFLQuantizationParameters.h"
#import "tensorflow/lite/objc/apis/TFLQuantizationParameters.h"
#import <XCTest/XCTest.h>
#import "tensorflow/lite/experimental/objc/sources/TFLQuantizationParameters+Internal.h"
#import "tensorflow/lite/objc/sources/TFLQuantizationParameters+Internal.h"
NS_ASSUME_NONNULL_BEGIN

View File

@ -1,7 +1,7 @@
# TensorFlow Lite for Swift
load("//tensorflow/lite:special_rules.bzl", "ios_visibility_whitelist", "tflite_ios_lab_runner")
load("//tensorflow/lite/experimental/ios:ios.bzl", "TFL_DEFAULT_TAGS", "TFL_DISABLED_SANITIZER_TAGS", "TFL_MINIMUM_OS_VERSION")
load("//tensorflow/lite/ios:ios.bzl", "TFL_DEFAULT_TAGS", "TFL_DISABLED_SANITIZER_TAGS", "TFL_MINIMUM_OS_VERSION")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework", "ios_unit_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
@ -59,7 +59,7 @@ swift_library(
tags = TFL_DEFAULT_TAGS + ["nobuilder"],
visibility = ios_visibility_whitelist(),
deps = [
"//tensorflow/lite/experimental/ios:tensorflow_lite_c",
"//tensorflow/lite/ios:tensorflow_lite_c",
] + select({
":use_coreml_delegate": [
"//tensorflow/lite/experimental/delegates/coreml:coreml_delegate",
@ -86,15 +86,15 @@ swift_library(
deps = [
"//tensorflow/lite/delegates/gpu:metal_delegate",
"//tensorflow/lite/experimental/delegates/coreml:coreml_delegate",
"//tensorflow/lite/experimental/ios:tensorflow_lite_c",
"//tensorflow/lite/ios:tensorflow_lite_c",
],
)
# bazel build -c opt --config=ios_fat //tensorflow/lite/experimental/swift:TensorFlowLite_framework
# bazel build -c opt --config=ios_fat //tensorflow/lite/swift:TensorFlowLite_framework
ios_static_framework(
name = "TensorFlowLite_framework",
avoid_deps = [
"//tensorflow/lite/experimental/ios:tensorflow_lite_c",
"//tensorflow/lite/ios:tensorflow_lite_c",
],
bundle_name = "TensorFlowLite",
minimum_os_version = TFL_MINIMUM_OS_VERSION,

View File

@ -42,7 +42,7 @@ In your `BUILD` file, add the `TensorFlowLite` dependency to your target:
```python
swift_library(
deps = [
"//tensorflow/lite/experimental/swift:TensorFlowLite",
"//tensorflow/lite/swift:TensorFlowLite",
],
)
```
@ -56,25 +56,25 @@ import TensorFlowLite
Build the `TensorFlowLite` Swift library target:
```shell
bazel build tensorflow/lite/experimental/swift:TensorFlowLite
bazel build tensorflow/lite/swift:TensorFlowLite
```
Build the `Tests` target:
```shell
bazel test tensorflow/lite/experimental/swift:Tests --swiftcopt=-enable-testing
bazel test tensorflow/lite/swift:Tests --swiftcopt=-enable-testing
```
Note: `--swiftcopt=-enable-testing` is required for optimized builds (`-c opt`).
#### Generate the Xcode project using Tulsi
Open the `//tensorflow/lite/experimental/swift/TensorFlowLite.tulsiproj` using
Open the `//tensorflow/lite/swift/TensorFlowLite.tulsiproj` using
the [TulsiApp](https://github.com/bazelbuild/tulsi)
or by running the
[`generate_xcodeproj.sh`](https://github.com/bazelbuild/tulsi/blob/master/src/tools/generate_xcodeproj.sh)
script from the root `tensorflow` directory:
```shell
generate_xcodeproj.sh --genconfig tensorflow/lite/experimental/swift/TensorFlowLite.tulsiproj:TensorFlowLite --outputfolder ~/path/to/generated/TensorFlowLite.xcodeproj
generate_xcodeproj.sh --genconfig tensorflow/lite/swift/TensorFlowLite.tulsiproj:TensorFlowLite --outputfolder ~/path/to/generated/TensorFlowLite.xcodeproj
```

View File

@ -1,11 +1,11 @@
{
"additionalFilePaths" : [
"tensorflow/lite/experimental/swift/BUILD"
"tensorflow/lite/swift/BUILD"
],
"buildTargets" : [
"//tensorflow/lite/experimental/swift:TensorFlowLiteAllDelegates",
"//tensorflow/lite/experimental/swift:Tests",
"//tensorflow/lite/experimental/swift:TestsLibrary"
"//tensorflow/lite/swift:TensorFlowLiteAllDelegates",
"//tensorflow/lite/swift:Tests",
"//tensorflow/lite/swift:TestsLibrary"
],
"optionSet" : {
"BazelBuildOptionsDebug" : {
@ -54,8 +54,8 @@
"projectName" : "TensorFlowLite",
"sourceFilters" : [
"tensorflow/lite/c",
"tensorflow/lite/experimental/swift",
"tensorflow/lite/experimental/swift/Sources",
"tensorflow/lite/experimental/swift/Tests"
"tensorflow/lite/swift",
"tensorflow/lite/swift/Sources",
"tensorflow/lite/swift/Tests"
]
}

View File

@ -11,7 +11,7 @@
},
"projectName" : "TensorFlowLite",
"packages" : [
"tensorflow/lite/experimental/swift"
"tensorflow/lite/swift"
],
"workspaceRoot" : "../../../../.."
"workspaceRoot" : "../../../.."
}

View File

@ -19,7 +19,7 @@ Pod::Spec.new do |s|
s.static_framework = true
tfl_dir = 'tensorflow/lite/'
swift_dir = tfl_dir + 'experimental/swift/'
swift_dir = tfl_dir + 'swift/'
s.default_subspec = 'Core'

View File

@ -1,5 +1,5 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("//tensorflow/lite/experimental/ios:ios.bzl", "TFL_MINIMUM_OS_VERSION")
load("//tensorflow/lite/ios:ios.bzl", "TFL_MINIMUM_OS_VERSION")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework")
package(