Updated formatting

This commit is contained in:
Prianka Liz Kariat 2023-02-01 18:52:55 +05:30
parent d588f73a6d
commit 85c310d01c
5 changed files with 14 additions and 14 deletions

View File

@ -23,7 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
* @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
* 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
* 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)
@interface MPPTextEmbedder : NSObject
@ -80,7 +82,7 @@ NS_SWIFT_NAME(TextEmbedder)
* @return A `MPPTextEmbedderResult` object that contains a list of embeddings.
*/
- (nullable MPPTextEmbedderResult *)embedText:(NSString *)text
error:(NSError **)error NS_SWIFT_NAME(embed(text:));
error:(NSError **)error NS_SWIFT_NAME(embed(text:));
- (instancetype)init NS_UNAVAILABLE;

View File

@ -89,8 +89,8 @@ static NSString *const kTaskGraphName = @"mediapipe.tasks.text.text_embedder.Tex
}
return [MPPTextEmbedderResult
textEmbedderResultWithOutputPacket:statusOrOutputPacketMap.value()
[kEmbeddingsOutStreamName.cppString]];
textEmbedderResultWithOutputPacket:statusOrOutputPacketMap
.value()[kEmbeddingsOutStreamName.cppString]];
}
@end

View File

@ -17,8 +17,8 @@
#import "mediapipe/tasks/ios/common/utils/sources/NSString+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/text/text_embedder/proto/text_embedder_graph_options.pb.h"
namespace {
using CalculatorOptionsProto = ::mediapipe::CalculatorOptions;

View File

@ -20,8 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface MPPTextEmbedderResult (Helpers)
+ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:
(const mediapipe::Packet &)packet;
+ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:(const mediapipe::Packet &)packet;
@end

View File

@ -20,8 +20,7 @@
static const int kMicroSecondsPerMilliSecond = 1000;
namespace {
using EmbeddingResultProto =
::mediapipe::tasks::components::containers::proto::EmbeddingResult;
using EmbeddingResultProto = ::mediapipe::tasks::components::containers::proto::EmbeddingResult;
using ::mediapipe::Packet;
} // namespace
@ -30,13 +29,13 @@ using ::mediapipe::Packet;
@implementation MPPTextEmbedderResult (Helpers)
+ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:(const Packet &)packet {
MPPEmbeddingResult *embeddingResult = [MPPEmbeddingResult
embeddingResultWithProto:packet.Get<EmbeddingResultProto>()];
MPPEmbeddingResult *embeddingResult =
[MPPEmbeddingResult embeddingResultWithProto:packet.Get<EmbeddingResultProto>()];
return [[MPPTextEmbedderResult alloc]
initWithEmbeddingResult:embeddingResult
timestampMs:(NSInteger)(packet.Timestamp().Value() /
kMicroSecondsPerMilliSecond)];
timestampMs:(NSInteger)(packet.Timestamp().Value() /
kMicroSecondsPerMilliSecond)];
}
@end