Skip to main content

ClusterEncoder

Trait ClusterEncoder 

Source
pub trait ClusterEncoder: Send + Sync {
    // Required methods
    fn encode_cluster(
        &self,
        cluster: &LocalCluster,
        hidden_states: Option<&[Vec<f32>]>,
    ) -> ClusterEmbedding;
    fn embedding_dim(&self) -> usize;

    // Provided method
    fn encode_clusters(
        &self,
        clusters: &[LocalCluster],
        hidden_states: Option<&[Vec<f32>]>,
    ) -> Vec<ClusterEmbedding> { ... }
}
Expand description

Trait for encoding clusters into fixed-size embeddings.

Required Methods§

Source

fn encode_cluster( &self, cluster: &LocalCluster, hidden_states: Option<&[Vec<f32>]>, ) -> ClusterEmbedding

Encode a single cluster into an embedding.

Source

fn embedding_dim(&self) -> usize

Expected embedding dimension.

Provided Methods§

Source

fn encode_clusters( &self, clusters: &[LocalCluster], hidden_states: Option<&[Vec<f32>]>, ) -> Vec<ClusterEmbedding>

Encode multiple clusters (batch operation).

Trait Implementations§

Source§

impl Debug for dyn ClusterEncoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§