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.

Public Constructors

Public Methods

static Embedding
create(float[] floatEmbedding, byte[] quantizedEmbedding, int headIndex, Optional<String> headName)
Creates an Embedding instance.
static Embedding
createFromProto(EmbeddingsProto.Embedding proto)
Creates an Embedding object from an ERROR(/EmbeddingsProto.Embedding) protobuf message.
abstract float[]
floatEmbedding()
Floating-point embedding.
abstract int
headIndex()
The index of the embedder head these entries refer to.
abstract Optional<String>
headName()
The optional name of the embedder head, which is the corresponding tensor metadata name.
abstract byte[]
quantizedEmbedding()
Quantized embedding.

Inherited Methods

Public Constructors

public Embedding ()

Public Methods

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

Creates an Embedding instance.

Parameters
floatEmbedding the floating-point embedding
quantizedEmbedding the quantized embedding.
headIndex the index of the embedder head.
headName the optional name of the embedder head.

public static Embedding createFromProto (EmbeddingsProto.Embedding proto)

Creates an Embedding object from an ERROR(/EmbeddingsProto.Embedding) protobuf message.

Parameters
proto the ERROR(/EmbeddingsProto.Embedding) protobuf message to convert.

public abstract float[] floatEmbedding ()

Floating-point embedding.

Empty if the embedder was configured to perform scalar quantization.

public abstract int headIndex ()

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

public abstract Optional<String> headName ()

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

public abstract byte[] quantizedEmbedding ()

Quantized embedding.

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