Updated formatting

This commit is contained in:
Prianka Liz Kariat 2023-02-01 18:48:10 +05:30
parent ffc9f1d47e
commit 69809e2181
4 changed files with 18 additions and 14 deletions

View File

@ -19,7 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface MPPEmbedding (Helpers)
+ (MPPEmbedding *)embeddingWithProto:(const ::mediapipe::tasks::components::containers::proto::Embedding &)embeddingProto;
+ (MPPEmbedding *)embeddingWithProto:
(const ::mediapipe::tasks::components::containers::proto::Embedding &)embeddingProto;
@end

View File

@ -31,7 +31,8 @@ using EmbeddingProto = ::mediapipe::tasks::components::containers::proto::Embedd
NSData *quantizedEmbedding;
if (embeddingProto.has_float_embedding()) {
floatEmbedding = [NSMutableArray arrayWithCapacity:embeddingProto.float_embedding().values_size()];
floatEmbedding =
[NSMutableArray arrayWithCapacity:embeddingProto.float_embedding().values_size()];
const auto floatEmbeddingValues = embeddingProto.float_embedding().values();
for (const auto value : embeddingProto.float_embedding().values()) {
@ -40,11 +41,11 @@ using EmbeddingProto = ::mediapipe::tasks::components::containers::proto::Embedd
}
if (embeddingProto.has_quantized_embedding()) {
const std::string& cppQuantizedEmbedding =
embeddingProto.quantized_embedding().values().data();
const std::string &cppQuantizedEmbedding = embeddingProto.quantized_embedding().values().data();
const char *cppQuantizedEmbeddingCString = cppQuantizedEmbedding.c_str();
quantizedEmbedding = [NSData dataWithBytes:cppQuantizedEmbeddingCString length:sizeof(cppQuantizedEmbeddingCString)];
quantizedEmbedding = [NSData dataWithBytes:cppQuantizedEmbeddingCString
length:sizeof(cppQuantizedEmbeddingCString)];
}
NSString *headName;

View File

@ -19,7 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface MPPEmbeddingResult (Helpers)
+ (MPPEmbeddingResult *)embeddingResultWithProto:(const ::mediapipe::tasks::components::containers::proto::EmbeddingResult &)embeddingResultProto;
+ (MPPEmbeddingResult *)embeddingResultWithProto:
(const ::mediapipe::tasks::components::containers::proto::EmbeddingResult &)
embeddingResultProto;
@end

View File

@ -23,9 +23,10 @@ using EmbeddingResultProto = ::mediapipe::tasks::components::containers::proto::
@implementation MPPEmbeddingResult (Helpers)
+ (MPPEmbeddingResult *)embeddingResultWithProto:(const EmbeddingResultProto &)embeddingResultProto {
NSMutableArray *embeddings = [NSMutableArray
arrayWithCapacity:(NSUInteger)embeddingResultProto.embeddings_size()];
+ (MPPEmbeddingResult *)embeddingResultWithProto:
(const EmbeddingResultProto &)embeddingResultProto {
NSMutableArray *embeddings =
[NSMutableArray arrayWithCapacity:(NSUInteger)embeddingResultProto.embeddings_size()];
for (const auto &embeddingProto : embeddingResultProto.embeddings()) {
[embeddings addObject:[MPPEmbedding embeddingWithProto:embeddingProto]];
}
@ -35,8 +36,7 @@ using EmbeddingResultProto = ::mediapipe::tasks::components::containers::proto::
timestampMs = (NSInteger)embeddingResultProto.timestamp_ms();
}
return [[MPPEmbeddingResult alloc] initWithEmbeddings:embeddings
timestampMs:timestampMs];
return [[MPPEmbeddingResult alloc] initWithEmbeddings:embeddings timestampMs:timestampMs];
}
@end