Make metal_delegate.h C-compatible.
PiperOrigin-RevId: 277749245 Change-Id: I03e8f801d3824806225b218d89874a355027f250
This commit is contained in:
parent
95b8a5792f
commit
23a967474a
@ -16,10 +16,11 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_DELEGATE_H_
|
||||
#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_DELEGATE_H_
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#else
|
||||
// For "C" 'bool' is not built-in type.
|
||||
#include <stdbool.h>
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef struct TfLiteDelegate TfLiteDelegate;
|
||||
@ -55,15 +56,6 @@ TfLiteDelegate* TFLGpuDelegateCreate(const TFLGpuDelegateOptions* options);
|
||||
// Destroys a delegate created with `TFLGpuDelegateCreate` call.
|
||||
void TFLGpuDelegateDelete(TfLiteDelegate* delegate);
|
||||
|
||||
// Binds Metal buffer to an input or an output tensor in the initialized
|
||||
// delegate. Bound buffer should have sufficient storage to accommodate all
|
||||
// elements of a tensor. Returns non-zero on success, or zero otherwise.
|
||||
//
|
||||
// *** Must be called *before* `Interpreter::ModifyGraphWithDelegate`. ***
|
||||
bool TFLGpuDelegateBindMetalBufferToTensor(TfLiteDelegate* delegate,
|
||||
int tensor_index,
|
||||
id<MTLBuffer> metal_buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
@ -22,6 +22,15 @@ limitations under the License.
|
||||
|
||||
struct TfLiteDelegate;
|
||||
|
||||
// Binds Metal buffer to an input or an output tensor in the initialized
|
||||
// delegate. Bound buffer should have sufficient storage to accommodate all
|
||||
// elements of a tensor. Returns non-zero on success, or zero otherwise.
|
||||
//
|
||||
// *** Must be called *before* `Interpreter::ModifyGraphWithDelegate`. ***
|
||||
bool TFLGpuDelegateBindMetalBufferToTensor(TfLiteDelegate* delegate,
|
||||
int tensor_index,
|
||||
id<MTLBuffer> metal_buffer);
|
||||
|
||||
// Binds user-defined MTLComputeCommandEncoder. The delegate puts all GPU tasks
|
||||
// into this encoder instead of the internal encoder.
|
||||
// The callback is a user-defined function to take control over encoder and
|
||||
|
Loading…
x
Reference in New Issue
Block a user