Internal MediaPipe Tasks change.
PiperOrigin-RevId: 514002859
This commit is contained in:
parent
dbe4175a08
commit
cd14d2e688
|
@ -25,6 +25,7 @@ limitations under the License.
|
||||||
namespace mediapipe {
|
namespace mediapipe {
|
||||||
namespace tasks {
|
namespace tasks {
|
||||||
namespace core {
|
namespace core {
|
||||||
|
// TODO: Use separate builtin op-resolvers.
|
||||||
MediaPipeBuiltinOpResolver::MediaPipeBuiltinOpResolver() {
|
MediaPipeBuiltinOpResolver::MediaPipeBuiltinOpResolver() {
|
||||||
AddCustom("MaxPoolingWithArgmax2D",
|
AddCustom("MaxPoolingWithArgmax2D",
|
||||||
mediapipe::tflite_operations::RegisterMaxPoolingWithArgmax2D());
|
mediapipe::tflite_operations::RegisterMaxPoolingWithArgmax2D());
|
||||||
|
|
|
@ -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<tflite::OpResolver> CreateUSEOpResolver() {
|
|
||||||
auto resolver =
|
|
||||||
absl::make_unique<tflite_shims::ops::builtin::BuiltinOpResolver>();
|
|
||||||
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
|
|
|
@ -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 <memory>
|
|
||||||
|
|
||||||
#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<tflite::OpResolver> CreateUSEOpResolver();
|
|
||||||
|
|
||||||
} // namespace mediapipe::tasks::text::text_embedder
|
|
||||||
|
|
||||||
#endif // MEDIAPIPE_TASKS_CC_TEXT_TEXT_EMBEDDER_TEXT_EMBEDDER_TEST_UTILS_H_
|
|
Loading…
Reference in New Issue
Block a user