TFLite iOS GPU: Tulsi project for testing operations.

PiperOrigin-RevId: 277540783
Change-Id: I2e287dfcf3d81bda3a7013ca56b36c78c52ba8ac
This commit is contained in:
A. Unique TensorFlower 2019-10-30 10:59:09 -07:00 committed by TensorFlower Gardener
parent 3d8ac5d46f
commit d77c616501
6 changed files with 222 additions and 4 deletions

View File

@ -1,4 +1,4 @@
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test")
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite", "tflite_ios_per_kernel_test")
package(
@ -91,7 +91,6 @@ cc_library(
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"@com_google_absl//absl/strings",
],
)
@ -200,7 +199,6 @@ objc_library(
"//tensorflow/lite/delegates/gpu/common:shape",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common:util",
"@com_google_absl//absl/strings",
],
)
@ -231,6 +229,100 @@ cc_library(
hdrs = ["runtime_options.h"],
)
objc_library(
name = "TestBinary",
testonly = 1,
srcs = ["host.m"],
sdk_frameworks = ["UIKit"],
)
# Application for local testing in XCode
ios_application(
name = "TestApplication",
testonly = 1,
bundle_id = "com.tensorflow.lite.delegates.gpu.metal.ComponentsTests",
families = [
"iphone",
],
infoplists = ["Info.plist"],
minimum_os_version = "10.0",
provisioning_profile = "//tensorflow/lite/delegates/gpu/metal:provisioning_profile.mobileprovision",
tags = [
"local",
"notap",
],
deps = [":TestBinary"],
)
objc_library(
name = "kernel_tests_lib",
testonly = 1,
srcs = [
"//tensorflow/lite/delegates/gpu/metal/kernels:add_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:concat_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:conv_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:depthwise_conv_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:elementwise_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:fully_connected_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:max_unpooling_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:mul_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:padding_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:pooling_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:prelu_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:relu_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:reshape_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:slice_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:softmax_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:transpose_conv_test.mm",
"//tensorflow/lite/delegates/gpu/metal/kernels:upsample_test.mm",
],
hdrs = [
],
sdk_frameworks = ["XCTest"],
deps = [
"//tensorflow/lite/delegates/gpu/common:shape",
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/metal:common",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:inference_context",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"//tensorflow/lite/delegates/gpu/metal/kernels:test_util",
],
)
objc_library(
name = "common_tests_lib",
testonly = 1,
srcs = [
"//tensorflow/lite/delegates/gpu/metal:common_test.mm",
"//tensorflow/lite/delegates/gpu/metal:compiled_model_test.mm",
"//tensorflow/lite/delegates/gpu/metal:environment_test.mm",
"//tensorflow/lite/delegates/gpu/metal:inference_context_test.mm",
],
hdrs = [
],
sdk_frameworks = ["XCTest"],
deps = [
"//tensorflow/lite/delegates/gpu/metal:common",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:inference_context",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"@com_google_absl//absl/memory",
],
)
ios_unit_test(
name = "ComponentsTests",
minimum_os_version = "10.0",
tags = ["notap"],
test_host = ":TestApplication",
deps = [
":common_tests_lib",
":kernel_tests_lib",
],
)
tflite_portable_test_suite()
tflite_ios_per_kernel_test()

View File

@ -0,0 +1,14 @@
{
"sourceFilters" : [
"tensorflow/lite/delegates/gpu/...",
],
"buildTargets" : [
"//tensorflow/lite/delegates/gpu/metal:ComponentsTests",
],
"projectName" : "ComponentsTests",
"additionalFilePaths" : [
"tensorflow/lite/delegates/gpu/BUILD",
"tensorflow/lite/delegates/gpu/metal/BUILD",
"tensorflow/lite/delegates/gpu/metal/kernels/BUILD",
]
}

View File

@ -0,0 +1,14 @@
{
"configDefaults" : {
"optionSet" : {
"ProjectGenerationPlatformConfiguration" : {
"p" : "ios_arm64"
}
}
},
"packages" : [
"tensorflow/lite/delegates/gpu/metal"
],
"projectName" : "ComponentsTests",
"workspaceRoot" : "../../../../../.."
}

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

View File

@ -0,0 +1,53 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// This is a shell app used for hosting the unittests. This way any real app
// startup code doesn't get in the way when running unittests.
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@end
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
}
- (void)applicationWillTerminate:(UIApplication *)application {
}
@end
int main(int argc, char *argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, @"AppDelegate");
}
}

View File

@ -728,7 +728,7 @@ objc_library(
"//tensorflow/lite/delegates/gpu/metal:inference_context",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"@FP16",
"@com_google_absl//absl/random",
"@com_google_absl//absl/memory",
],
)