pub struct CandleClusterEncoder<E: CandleTextEncoder> { /* private fields */ }Expand description
Neural cluster encoder using Candle.
Encodes clusters using:
- Pre-trained text encoder for mention representations
- Single-layer Transformer for cluster pooling (xCoRe style)
Implementations§
Source§impl<E: CandleTextEncoder> CandleClusterEncoder<E>
impl<E: CandleTextEncoder> CandleClusterEncoder<E>
Sourcepub fn new(encoder: E, config: NeuralClusterConfig) -> Result<Self>
pub fn new(encoder: E, config: NeuralClusterConfig) -> Result<Self>
Create a new neural cluster encoder.
Trait Implementations§
Source§impl<E: CandleTextEncoder> ClusterEncoder for CandleClusterEncoder<E>
Available on crate feature candle only.
impl<E: CandleTextEncoder> ClusterEncoder for CandleClusterEncoder<E>
Available on crate feature
candle only.Source§fn encode_cluster(
&self,
cluster: &LocalCluster,
_hidden_states: Option<&[Vec<f32>]>,
) -> ClusterEmbedding
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
fn embedding_dim(&self) -> usize
Expected embedding dimension.
Source§fn encode_clusters(
&self,
clusters: &[LocalCluster],
hidden_states: Option<&[Vec<f32>]>,
) -> Vec<ClusterEmbedding>
fn encode_clusters( &self, clusters: &[LocalCluster], hidden_states: Option<&[Vec<f32>]>, ) -> Vec<ClusterEmbedding>
Encode multiple clusters (batch operation).
Auto Trait Implementations§
impl<E> !RefUnwindSafe for CandleClusterEncoder<E>
impl<E> !UnwindSafe for CandleClusterEncoder<E>
impl<E> Freeze for CandleClusterEncoder<E>where
E: Freeze,
impl<E> Send for CandleClusterEncoder<E>
impl<E> Sync for CandleClusterEncoder<E>
impl<E> Unpin for CandleClusterEncoder<E>where
E: Unpin,
impl<E> UnsafeUnpin for CandleClusterEncoder<E>where
E: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more