MediaPipeTasksText Framework Reference

Embedding

class Embedding : 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

    Swift

    var floatEmbedding: [NSNumber]? { get }
  • @brief The embedding represented as an NSArray of UInt8 values. Empty if the embedder was not configured to perform scalar quantization.

    Declaration

    Swift

    var quantizedEmbedding: [NSNumber]? { get }
  • The index of the embedder head these entries refer to. This is useful for multi-head models.

    Declaration

    Swift

    var headIndex: Int { get }
  • The optional name of the embedder head, which is the corresponding tensor metadata name.

    Declaration

    Swift

    var headName: String? { get }
  • Initializes a new MPPEmbedding with the given float embedding, quantized embedding, head index and head name.

    Declaration

    Swift

    init(floatEmbedding: [NSNumber]?, quantizedEmbedding: [NSNumber]?, head headIndex: Int, headName: String?)

    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

  • Undocumented