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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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,13 +29,13 @@ 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
timestampMs:(NSInteger)(packet.Timestamp().Value() / timestampMs:(NSInteger)(packet.Timestamp().Value() /
kMicroSecondsPerMilliSecond)]; kMicroSecondsPerMilliSecond)];
} }
@end @end