Embedding

public abstract class Embedding


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.

Summary

Public constructors

Public methods

static Embedding
create(
    float[] floatEmbedding,
    byte[] quantizedEmbedding,
    int headIndex,
    Optional<String> headName
)

Creates an Embedding instance.

static Embedding

Creates an Embedding object from an EmbeddingsProto.Embedding protobuf message.

abstract float[]

Floating-point embedding.

abstract int

The index of the embedder head these entries refer to.

abstract Optional<String>

The optional name of the embedder head, which is the corresponding tensor metadata name.

abstract byte[]

Quantized embedding.

Public constructors

Embedding

public Embedding()

Public methods

create

public static Embedding create(
    float[] floatEmbedding,
    byte[] quantizedEmbedding,
    int headIndex,
    Optional<String> headName
)

Creates an Embedding instance.

Parameters
float[] floatEmbedding

the floating-point embedding

byte[] quantizedEmbedding

the quantized embedding.

int headIndex

the index of the embedder head.

Optional<String> headName

the optional name of the embedder head.

createFromProto

public static Embedding createFromProto(EmbeddingsProto.Embedding proto)

Creates an Embedding object from an EmbeddingsProto.Embedding protobuf message.

Parameters
EmbeddingsProto.Embedding proto

the EmbeddingsProto.Embedding protobuf message to convert.

floatEmbedding

public abstract float[] floatEmbedding()

Floating-point embedding.

Empty if the embedder was configured to perform scalar quantization.

headIndex

public abstract int headIndex()

The index of the embedder head these entries refer to. This is useful for multi-head models.

headName

public abstract Optional<String> headName()

The optional name of the embedder head, which is the corresponding tensor metadata name.

quantizedEmbedding

public abstract byte[] quantizedEmbedding()

Quantized embedding.

Empty if the embedder was not configured to perform scalar quantization.