-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
186 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
ios/TensorFlowLiteCCoreML.framework/Headers/TensorFlowLiteCCoreML.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#import <TensorFlowLiteCCoreML/coreml_delegate.h> |
72 changes: 72 additions & 0 deletions
72
ios/TensorFlowLiteCCoreML.framework/Headers/coreml_delegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* 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. | ||
==============================================================================*/ | ||
#ifndef TENSORFLOW_LITE_DELEGATES_COREML_COREML_DELEGATE_H_ | ||
#define TENSORFLOW_LITE_DELEGATES_COREML_COREML_DELEGATE_H_ | ||
|
||
#include "TensorFlowLiteC/common.h" | ||
|
||
// LINT.IfChange | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
typedef enum { | ||
// Create Core ML delegate only on devices with Apple Neural Engine. | ||
// Returns nullptr otherwise. | ||
TfLiteCoreMlDelegateDevicesWithNeuralEngine, | ||
// Always create Core ML delegate | ||
TfLiteCoreMlDelegateAllDevices | ||
} TfLiteCoreMlDelegateEnabledDevices; | ||
|
||
typedef struct { | ||
// Only create delegate when Neural Engine is available on the device. | ||
TfLiteCoreMlDelegateEnabledDevices enabled_devices; | ||
// Specifies target Core ML version for model conversion. | ||
// Core ML 3 come with a lot more ops, but some ops (e.g. reshape) is not | ||
// delegated due to input rank constraint. | ||
// if not set to one of the valid versions, the delegate will use highest | ||
// version possible in the platform. | ||
// Valid versions: (2, 3) | ||
int coreml_version; | ||
// This sets the maximum number of Core ML delegates created. | ||
// Each graph corresponds to one delegated node subset in the | ||
// TFLite model. Set this to 0 to delegate all possible partitions. | ||
int max_delegated_partitions; | ||
// This sets the minimum number of nodes per partition delegated with | ||
// Core ML delegate. Defaults to 2. | ||
int min_nodes_per_partition; | ||
#ifdef TFLITE_DEBUG_DELEGATE | ||
// This sets the index of the first node that could be delegated. | ||
int first_delegate_node_index; | ||
// This sets the index of the last node that could be delegated. | ||
int last_delegate_node_index; | ||
#endif | ||
} TfLiteCoreMlDelegateOptions; | ||
|
||
// Return a delegate that uses CoreML for ops execution. | ||
// Must outlive the interpreter. | ||
TfLiteDelegate* TfLiteCoreMlDelegateCreate( | ||
const TfLiteCoreMlDelegateOptions* options); | ||
|
||
// Do any needed cleanup and delete 'delegate'. | ||
void TfLiteCoreMlDelegateDelete(TfLiteDelegate* delegate); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif // __cplusplus | ||
|
||
// LINT.ThenChange(README.md) | ||
|
||
#endif // TENSORFLOW_LITE_DELEGATES_COREML_COREML_DELEGATE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
framework module TensorFlowLiteCCoreML { | ||
umbrella header "TensorFlowLiteCCoreML.h" | ||
export * | ||
module * { export * } | ||
link "m" | ||
link "pthread" | ||
link framework "CoreML" | ||
link framework "Foundation" | ||
} |
Binary file not shown.
Oops, something went wrong.