MediaPipeTasksText Framework Reference

MPPEmbedding


@interface MPPEmbedding : NSObject

Represents the embedding for a given embedder head. Typically used in embedding tasks.

One and only one of the two ‘floatEmbedding’ and ‘quantizedEmbedding’ will contain data, based on whether or not the embedder was configured to perform scala quantization.

  • @brief The embedding represented as an NSArray of Float values. Empty if the embedder was configured to perform scalar quantization.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSArray<NSNumber *> *floatEmbedding;
  • @brief The embedding represented as an NSArray of UInt8 values. Empty if the embedder was not configured to perform scalar quantization.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSArray<NSNumber *> *quantizedEmbedding;
  • The index of the embedder head these entries refer to. This is useful for multi-head models.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger headIndex;
  • The optional name of the embedder head, which is the corresponding tensor metadata name.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *headName;
  • Initializes a new MPPEmbedding with the given float embedding, quantized embedding, head index and head name.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithFloatEmbedding:(nullable NSArray<NSNumber *> *)floatEmbedding
            quantizedEmbedding:(nullable NSArray<NSNumber *> *)quantizedEmbedding
                     headIndex:(NSInteger)headIndex
                      headName:(nullable NSString *)headName;

    Parameters

    floatEmbedding

    The optional Floating-point embedding.

    quantizedEmbedding

    The optional Quantized embedding.

    headIndex

    The index of the embedder head.

    headName

    The optional name of the embedder head.

    Return Value

    An instance of MPPEmbedding initialized with the given float embedding, quantized embedding, head index and head name.

  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Undocumented

    Declaration

    Objective-C

    + (instancetype)new NS_UNAVAILABLE;