Updated formatting
This commit is contained in:
parent
d588f73a6d
commit
85c310d01c
|
@ -23,7 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
/**
|
/**
|
||||||
* @brief Performs embedding extraction on text.
|
* @brief Performs embedding extraction on text.
|
||||||
*
|
*
|
||||||
* This API expects a TFLite model with (optional) [TFLite Model Metadata](https://www.tensorflow.org/lite/convert/metadata").
|
* This API expects a TFLite model with (optional) [TFLite Model
|
||||||
|
* Metadata](https://www.tensorflow.org/lite/convert/metadata").
|
||||||
*
|
*
|
||||||
* Metadata is required for models with int32 input tensors because it contains the input process
|
* Metadata is required for models with int32 input tensors because it contains the input process
|
||||||
* unit for the model's Tokenizer. No metadata is required for models with string input tensors.
|
* unit for the model's Tokenizer. No metadata is required for models with string input tensors.
|
||||||
|
@ -38,7 +39,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
* - Or one input tensor (`kTfLiteString`) that is shapeless or has shape `[1]` containing
|
* - Or one input tensor (`kTfLiteString`) that is shapeless or has shape `[1]` containing
|
||||||
* the input string.
|
* the input string.
|
||||||
*
|
*
|
||||||
* At least one output tensor (`kTfLiteFloat32`/`kTfLiteUint8`) with shape `[1 x N]` where `N` is the number of dimensions in the produced embeddings.
|
* At least one output tensor (`kTfLiteFloat32`/`kTfLiteUint8`) with shape `[1 x N]` where `N` is
|
||||||
|
* the number of dimensions in the produced embeddings.
|
||||||
*/
|
*/
|
||||||
NS_SWIFT_NAME(TextEmbedder)
|
NS_SWIFT_NAME(TextEmbedder)
|
||||||
@interface MPPTextEmbedder : NSObject
|
@interface MPPTextEmbedder : NSObject
|
||||||
|
|
|
@ -89,8 +89,8 @@ static NSString *const kTaskGraphName = @"mediapipe.tasks.text.text_embedder.Tex
|
||||||
}
|
}
|
||||||
|
|
||||||
return [MPPTextEmbedderResult
|
return [MPPTextEmbedderResult
|
||||||
textEmbedderResultWithOutputPacket:statusOrOutputPacketMap.value()
|
textEmbedderResultWithOutputPacket:statusOrOutputPacketMap
|
||||||
[kEmbeddingsOutStreamName.cppString]];
|
.value()[kEmbeddingsOutStreamName.cppString]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#import "mediapipe/tasks/ios/common/utils/sources/NSString+Helpers.h"
|
#import "mediapipe/tasks/ios/common/utils/sources/NSString+Helpers.h"
|
||||||
#import "mediapipe/tasks/ios/core/utils/sources/MPPBaseOptions+Helpers.h"
|
#import "mediapipe/tasks/ios/core/utils/sources/MPPBaseOptions+Helpers.h"
|
||||||
|
|
||||||
#include "mediapipe/tasks/cc/text/text_embedder/proto/text_embedder_graph_options.pb.h"
|
|
||||||
#include "mediapipe/tasks/cc/components/processors/proto/embedder_options.pb.h"
|
#include "mediapipe/tasks/cc/components/processors/proto/embedder_options.pb.h"
|
||||||
|
#include "mediapipe/tasks/cc/text/text_embedder/proto/text_embedder_graph_options.pb.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using CalculatorOptionsProto = ::mediapipe::CalculatorOptions;
|
using CalculatorOptionsProto = ::mediapipe::CalculatorOptions;
|
||||||
|
|
|
@ -20,8 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface MPPTextEmbedderResult (Helpers)
|
@interface MPPTextEmbedderResult (Helpers)
|
||||||
|
|
||||||
+ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:
|
+ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:(const mediapipe::Packet &)packet;
|
||||||
(const mediapipe::Packet &)packet;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
static const int kMicroSecondsPerMilliSecond = 1000;
|
static const int kMicroSecondsPerMilliSecond = 1000;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using EmbeddingResultProto =
|
using EmbeddingResultProto = ::mediapipe::tasks::components::containers::proto::EmbeddingResult;
|
||||||
::mediapipe::tasks::components::containers::proto::EmbeddingResult;
|
|
||||||
using ::mediapipe::Packet;
|
using ::mediapipe::Packet;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -30,8 +29,8 @@ using ::mediapipe::Packet;
|
||||||
@implementation MPPTextEmbedderResult (Helpers)
|
@implementation MPPTextEmbedderResult (Helpers)
|
||||||
|
|
||||||
+ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:(const Packet &)packet {
|
+ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:(const Packet &)packet {
|
||||||
MPPEmbeddingResult *embeddingResult = [MPPEmbeddingResult
|
MPPEmbeddingResult *embeddingResult =
|
||||||
embeddingResultWithProto:packet.Get<EmbeddingResultProto>()];
|
[MPPEmbeddingResult embeddingResultWithProto:packet.Get<EmbeddingResultProto>()];
|
||||||
|
|
||||||
return [[MPPTextEmbedderResult alloc]
|
return [[MPPTextEmbedderResult alloc]
|
||||||
initWithEmbeddingResult:embeddingResult
|
initWithEmbeddingResult:embeddingResult
|
||||||
|
|
Loading…
Reference in New Issue
Block a user