From cd14d2e6883f621623ccff8a35352695383b9023 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Fri, 3 Mar 2023 22:21:48 -0800 Subject: [PATCH] Internal MediaPipe Tasks change. PiperOrigin-RevId: 514002859 --- .../cc/core/mediapipe_builtin_op_resolver.cc | 1 + .../text_embedder/text_embedder_test_utils.cc | 40 ------------------- .../text_embedder/text_embedder_test_utils.h | 32 --------------- 3 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.cc delete mode 100644 mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.h diff --git a/mediapipe/tasks/cc/core/mediapipe_builtin_op_resolver.cc b/mediapipe/tasks/cc/core/mediapipe_builtin_op_resolver.cc index 62898a005..be8dec684 100644 --- a/mediapipe/tasks/cc/core/mediapipe_builtin_op_resolver.cc +++ b/mediapipe/tasks/cc/core/mediapipe_builtin_op_resolver.cc @@ -25,6 +25,7 @@ limitations under the License. namespace mediapipe { namespace tasks { namespace core { +// TODO: Use separate builtin op-resolvers. MediaPipeBuiltinOpResolver::MediaPipeBuiltinOpResolver() { AddCustom("MaxPoolingWithArgmax2D", mediapipe::tflite_operations::RegisterMaxPoolingWithArgmax2D()); diff --git a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.cc b/mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.cc deleted file mode 100644 index f3e248722..000000000 --- a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2022 The MediaPipe 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. -==============================================================================*/ - -#include "mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.h" - -#include "absl/memory/memory.h" -#include "tensorflow/lite/core/shims/cc/kernels/register.h" - -namespace tflite::ops::custom { -TfLiteRegistration* Register_SENTENCEPIECE_TOKENIZER(); -TfLiteRegistration* Register_RAGGED_TENSOR_TO_TENSOR(); -} // namespace tflite::ops::custom - -namespace mediapipe::tasks::text::text_embedder { - -std::unique_ptr CreateUSEOpResolver() { - auto resolver = - absl::make_unique(); - resolver->AddCustom( - "TFSentencepieceTokenizeOp", - ::tflite::ops::custom::Register_SENTENCEPIECE_TOKENIZER()); - resolver->AddCustom( - "RaggedTensorToTensor", - ::tflite::ops::custom::Register_RAGGED_TENSOR_TO_TENSOR()); - return resolver; -} - -} // namespace mediapipe::tasks::text::text_embedder diff --git a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.h b/mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.h deleted file mode 100644 index 42f82af20..000000000 --- a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test_utils.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2022 The MediaPipe 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 MEDIAPIPE_TASKS_CC_TEXT_TEXT_EMBEDDER_TEXT_EMBEDDER_TEST_UTILS_H_ -#define MEDIAPIPE_TASKS_CC_TEXT_TEXT_EMBEDDER_TEXT_EMBEDDER_TEST_UTILS_H_ - -#include - -#include "tensorflow/lite/core/api/op_resolver.h" - -namespace mediapipe::tasks::text::text_embedder { - -// Creates a custom OpResolver containing the additional SENTENCEPIECE_TOKENIZER -// and RAGGED_TENSOR_TO_TENSOR ops needed by universal sentence encoder-based -// models. -std::unique_ptr CreateUSEOpResolver(); - -} // namespace mediapipe::tasks::text::text_embedder - -#endif // MEDIAPIPE_TASKS_CC_TEXT_TEXT_EMBEDDER_TEXT_EMBEDDER_TEST_UTILS_H_