Internal change

PiperOrigin-RevId: 514835354
This commit is contained in:
MediaPipe Team 2023-03-07 14:10:07 -08:00 committed by Copybara-Service
parent 46b5c4012d
commit 225dd36a63
3 changed files with 42 additions and 5 deletions

View File

@ -476,11 +476,20 @@ cc_library(
], ],
) )
cc_library_with_tflite(
name = "tflite_delegate_ptr",
hdrs = ["tflite_delegate_ptr.h"],
tflite_deps = [
"@org_tensorflow//tensorflow/lite/core/shims:c_api_types",
],
)
cc_library_with_tflite( cc_library_with_tflite(
name = "inference_interpreter_delegate_runner", name = "inference_interpreter_delegate_runner",
srcs = ["inference_interpreter_delegate_runner.cc"], srcs = ["inference_interpreter_delegate_runner.cc"],
hdrs = ["inference_interpreter_delegate_runner.h"], hdrs = ["inference_interpreter_delegate_runner.h"],
tflite_deps = [ tflite_deps = [
":tflite_delegate_ptr",
"//mediapipe/util/tflite:tflite_model_loader", "//mediapipe/util/tflite:tflite_model_loader",
"@org_tensorflow//tensorflow/lite/core/shims:c_api_types", "@org_tensorflow//tensorflow/lite/core/shims:c_api_types",
"@org_tensorflow//tensorflow/lite/core/shims:framework_stable", "@org_tensorflow//tensorflow/lite/core/shims:framework_stable",

View File

@ -20,6 +20,7 @@
#include "absl/status/statusor.h" #include "absl/status/statusor.h"
#include "mediapipe/calculators/tensor/inference_runner.h" #include "mediapipe/calculators/tensor/inference_runner.h"
#include "mediapipe/calculators/tensor/tflite_delegate_ptr.h"
#include "mediapipe/framework/api2/packet.h" #include "mediapipe/framework/api2/packet.h"
#include "mediapipe/util/tflite/tflite_model_loader.h" #include "mediapipe/util/tflite/tflite_model_loader.h"
#include "tensorflow/lite/core/api/op_resolver.h" #include "tensorflow/lite/core/api/op_resolver.h"
@ -27,11 +28,6 @@
namespace mediapipe { namespace mediapipe {
// TODO: Consider renaming TfLiteDelegatePtr.
using TfLiteDelegatePtr =
std::unique_ptr<TfLiteOpaqueDelegate,
std::function<void(TfLiteOpaqueDelegate*)>>;
// Creates inference runner which run inference using newly initialized // Creates inference runner which run inference using newly initialized
// interpreter and provided `delegate`. // interpreter and provided `delegate`.
// //

View File

@ -0,0 +1,32 @@
// Copyright 2022 The MediaPipe Authors.
//
// 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 MEDIAPIPE_CALCULATORS_TENSOR_TFLITE_DELEGATE_PTR_H_
#define MEDIAPIPE_CALCULATORS_TENSOR_TFLITE_DELEGATE_PTR_H_
#include <functional>
#include <memory>
#include "tensorflow/lite/core/shims/c/c_api_types.h"
namespace mediapipe {
// TODO: Consider renaming TfLiteDelegatePtr.
using TfLiteDelegatePtr =
std::unique_ptr<TfLiteOpaqueDelegate,
std::function<void(TfLiteOpaqueDelegate*)>>;
} // namespace mediapipe
#endif // MEDIAPIPE_CALCULATORS_TENSOR_TFLITE_DELEGATE_PTR_H_