Updates the TensorFlow Lite podspecs.
PiperOrigin-RevId: 240591671
This commit is contained in:
parent
047abbc428
commit
e29d0968f4
@ -13,7 +13,6 @@ load(
|
|||||||
"//tensorflow/lite:build_def.bzl",
|
"//tensorflow/lite:build_def.bzl",
|
||||||
"tflite_cc_shared_object",
|
"tflite_cc_shared_object",
|
||||||
"tflite_copts",
|
"tflite_copts",
|
||||||
"tflite_jni_binary",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
tflite_cc_shared_object(
|
tflite_cc_shared_object(
|
||||||
@ -39,22 +38,28 @@ tflite_cc_shared_object(
|
|||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "c_api_internal",
|
name = "c_api_internal",
|
||||||
srcs = ["c_api.h"],
|
srcs = [
|
||||||
|
"c_api.h",
|
||||||
|
"c_api_types.h",
|
||||||
|
],
|
||||||
hdrs = ["c_api_internal.h"],
|
hdrs = ["c_api_internal.h"],
|
||||||
copts = tflite_copts(),
|
copts = tflite_copts(),
|
||||||
visibility = [
|
visibility = [
|
||||||
"//tensorflow/lite/experimental/c:__subpackages__",
|
"//tensorflow/lite/experimental/c:__subpackages__",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//tensorflow/lite:context",
|
|
||||||
"//tensorflow/lite:framework",
|
"//tensorflow/lite:framework",
|
||||||
|
"//tensorflow/lite/c:c_api_internal",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "c_api",
|
name = "c_api",
|
||||||
srcs = ["c_api.cc"],
|
srcs = ["c_api.cc"],
|
||||||
hdrs = ["c_api.h"],
|
hdrs = [
|
||||||
|
"c_api.h",
|
||||||
|
"c_api_types.h",
|
||||||
|
],
|
||||||
copts = tflite_copts(),
|
copts = tflite_copts(),
|
||||||
tags = ["swift_module=TensorFlowLiteC"],
|
tags = ["swift_module=TensorFlowLiteC"],
|
||||||
visibility = [
|
visibility = [
|
||||||
@ -62,9 +67,9 @@ cc_library(
|
|||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":c_api_internal",
|
":c_api_internal",
|
||||||
"//tensorflow/lite:context",
|
|
||||||
"//tensorflow/lite:framework",
|
"//tensorflow/lite:framework",
|
||||||
"//tensorflow/lite:version",
|
"//tensorflow/lite:version",
|
||||||
|
"//tensorflow/lite/c:c_api_internal",
|
||||||
"//tensorflow/lite/kernels:builtin_ops",
|
"//tensorflow/lite/kernels:builtin_ops",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@ -91,7 +96,7 @@ cc_test(
|
|||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":c_api",
|
":c_api",
|
||||||
"//tensorflow/lite:context",
|
"//tensorflow/lite/c:c_api_internal",
|
||||||
"//tensorflow/lite/testing:util",
|
"//tensorflow/lite/testing:util",
|
||||||
"@com_google_googletest//:gtest",
|
"@com_google_googletest//:gtest",
|
||||||
],
|
],
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#
|
#
|
||||||
# Add the build rules below to `//tensorflow/lite/experimental/c/BUILD`.
|
# Add the build rules below to `//tensorflow/lite/experimental/c/BUILD`.
|
||||||
# Build the framework:
|
# Build the framework:
|
||||||
# bazel build tensorflow/lite/experimental/c:TensorFlowLiteC_framework -c opt --ios_multi_cpus=x86_64,armv7,arm64
|
# bazel build tensorflow/lite/experimental/c:TensorFlowLiteC_framework -c fastbuild --ios_multi_cpus=x86_64,armv7,arm64 --apple_bitcode=embedded --copt=-fembed-bitcode
|
||||||
# Unzip the generated framework:
|
# Unzip the generated framework:
|
||||||
# unzip bazel-bin/tensorflow/lite/experimental/c/TensorFlowLiteC_framework.zip -d /Users/path/to/TensorFlowLiteC.framework
|
# unzip bazel-bin/tensorflow/lite/experimental/c/TensorFlowLiteC_framework.zip -d /Users/path/to/tensorflow/Frameworks
|
||||||
|
|
||||||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework")
|
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework")
|
||||||
load("@build_bazel_rules_apple//apple:versioning.bzl", "apple_bundle_version")
|
load("@build_bazel_rules_apple//apple:versioning.bzl", "apple_bundle_version")
|
||||||
@ -17,7 +17,10 @@ apple_bundle_version(
|
|||||||
|
|
||||||
ios_static_framework(
|
ios_static_framework(
|
||||||
name = "TensorFlowLiteC_framework",
|
name = "TensorFlowLiteC_framework",
|
||||||
hdrs = ["c_api.h"],
|
hdrs = [
|
||||||
|
"c_api.h",
|
||||||
|
"c_api_types.h",
|
||||||
|
],
|
||||||
bundle_name = "TensorFlowLiteC",
|
bundle_name = "TensorFlowLiteC",
|
||||||
minimum_os_version = "9.0",
|
minimum_os_version = "9.0",
|
||||||
version = ":TensorFlowLiteC_version",
|
version = ":TensorFlowLiteC_version",
|
||||||
|
@ -19,6 +19,5 @@ Pod::Spec.new do |s|
|
|||||||
|
|
||||||
s.module_name = 'TensorFlowLiteC'
|
s.module_name = 'TensorFlowLiteC'
|
||||||
s.library = 'c++'
|
s.library = 'c++'
|
||||||
s.static_framework = true
|
|
||||||
s.vendored_frameworks = 'Frameworks/TensorFlowLiteC.framework'
|
s.vendored_frameworks = 'Frameworks/TensorFlowLiteC.framework'
|
||||||
end
|
end
|
||||||
|
@ -16,9 +16,9 @@ limitations under the License.
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "tensorflow/lite/context.h"
|
|
||||||
#include "tensorflow/lite/error_reporter.h"
|
#include "tensorflow/lite/error_reporter.h"
|
||||||
#include "tensorflow/lite/experimental/c/c_api_internal.h"
|
#include "tensorflow/lite/experimental/c/c_api_internal.h"
|
||||||
|
#include "tensorflow/lite/experimental/c/c_api_types.h"
|
||||||
#include "tensorflow/lite/interpreter.h"
|
#include "tensorflow/lite/interpreter.h"
|
||||||
#include "tensorflow/lite/kernels/register.h"
|
#include "tensorflow/lite/kernels/register.h"
|
||||||
#include "tensorflow/lite/model.h"
|
#include "tensorflow/lite/model.h"
|
||||||
|
@ -21,7 +21,7 @@ limitations under the License.
|
|||||||
// Eventually the various C APIs defined in context.h will be migrated into
|
// Eventually the various C APIs defined in context.h will be migrated into
|
||||||
// the appropriate /c/c_api*.h header. For now, we pull in existing definitions
|
// the appropriate /c/c_api*.h header. For now, we pull in existing definitions
|
||||||
// for convenience.
|
// for convenience.
|
||||||
#include "tensorflow/lite/context.h"
|
#include "c_api_types.h"
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Experimental C API for TensorFlowLite.
|
// Experimental C API for TensorFlowLite.
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/lite/experimental/c/c_api.h"
|
#include "tensorflow/lite/experimental/c/c_api.h"
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "tensorflow/lite/context.h"
|
#include "tensorflow/lite/c/c_api_internal.h"
|
||||||
#include "tensorflow/lite/testing/util.h"
|
#include "tensorflow/lite/testing/util.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
1
tensorflow/lite/experimental/c/c_api_types.h
Symbolic link
1
tensorflow/lite/experimental/c/c_api_types.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../c/c_api_internal.h
|
@ -20,7 +20,6 @@ Pod::Spec.new do |s|
|
|||||||
|
|
||||||
s.module_name = 'TFLTensorFlowLite'
|
s.module_name = 'TFLTensorFlowLite'
|
||||||
s.static_framework = true
|
s.static_framework = true
|
||||||
s.prefix_header_file = false
|
|
||||||
|
|
||||||
base_dir = 'tensorflow/lite/experimental/objc/'
|
base_dir = 'tensorflow/lite/experimental/objc/'
|
||||||
s.public_header_files = base_dir + 'apis/*.h'
|
s.public_header_files = base_dir + 'apis/*.h'
|
||||||
@ -30,7 +29,7 @@ Pod::Spec.new do |s|
|
|||||||
s.pod_target_xcconfig = {
|
s.pod_target_xcconfig = {
|
||||||
'HEADER_SEARCH_PATHS' =>
|
'HEADER_SEARCH_PATHS' =>
|
||||||
'"${PODS_TARGET_SRCROOT}" ' +
|
'"${PODS_TARGET_SRCROOT}" ' +
|
||||||
'"${PODS_TARGET_SRCROOT}/"' + base_dir + '"apis"',
|
'"${PODS_TARGET_SRCROOT}/' + base_dir + 'apis"',
|
||||||
}
|
}
|
||||||
|
|
||||||
s.test_spec 'Tests' do |ts|
|
s.test_spec 'Tests' do |ts|
|
||||||
|
@ -54,8 +54,11 @@ public final class Interpreter {
|
|||||||
if options.isErrorLoggingEnabled {
|
if options.isErrorLoggingEnabled {
|
||||||
TFL_InterpreterOptionsSetErrorReporter(
|
TFL_InterpreterOptionsSetErrorReporter(
|
||||||
cOptions,
|
cOptions,
|
||||||
{ (_, format, arguments) in
|
{ (_, format, args) -> Void in
|
||||||
|
// Workaround for Swift optionality bug: https://bugs.swift.org/browse/SR-3429.
|
||||||
|
let optionalArgs: CVaListPointer? = args
|
||||||
guard let cFormat = format,
|
guard let cFormat = format,
|
||||||
|
let arguments = optionalArgs,
|
||||||
let message = String(cFormat: cFormat, arguments: arguments)
|
let message = String(cFormat: cFormat, arguments: arguments)
|
||||||
else {
|
else {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user