pub struct SampledEmbeddingSpace<'a> {
pub type_id: TypeId,
pub elaborator: Array2<f32>,
pub models: HashMap<TermIndex, SampledModelEmbedding>,
pub ctxt: &'a Context,
}Expand description
All information in a crate::sampled_embedder_state::SampledEmbedderState pertaining to a particular
function TypeId
Fields§
§type_id: TypeId§elaborator: Array2<f32>A sample drawn from the crate::elaborator::Elaborator for this type in the original
crate::embedder_state::EmbedderState.
Maps from the compressed space for the type to the base space for the type.
models: HashMap<TermIndex, SampledModelEmbedding>§ctxt: &'a ContextImplementations§
Source§impl<'a> SampledEmbeddingSpace<'a>
impl<'a> SampledEmbeddingSpace<'a>
Sourcepub fn has_embedding(&self, model_key: TermIndex) -> bool
pub fn has_embedding(&self, model_key: TermIndex) -> bool
Determines whether an embedding exists for the given TermIndex.
Sourcepub fn get_embedding(&self, model_key: TermIndex) -> &SampledModelEmbedding
pub fn get_embedding(&self, model_key: TermIndex) -> &SampledModelEmbedding
Gets the SampledModelEmbedding corresponding to the given TermIndex.
Sourcepub fn expand_compressed_vector(
&self,
compressed_vec: ArrayView1<'_, f32>,
) -> Array1<f32>
pub fn expand_compressed_vector( &self, compressed_vec: ArrayView1<'_, f32>, ) -> Array1<f32>
Given a compressed vector, uses self.elaborator to expand it to a vector in the
base space of self.type_id.
Sourcepub fn expand_compressed_function(
&self,
compressed_vec: ArrayView1<'_, f32>,
) -> Array2<f32>
pub fn expand_compressed_function( &self, compressed_vec: ArrayView1<'_, f32>, ) -> Array2<f32>
Given a compressed vector for a function of self.type_id,
first performs Self::expand_compressed_vector and
then inflates the result to yield a linear transformation
from the feature space of the input type to the compressed space of the output type.
Sourcepub fn new(
type_id: TypeId,
elaborator: Array2<f32>,
ctxt: &'a Context,
) -> SampledEmbeddingSpace<'a>
pub fn new( type_id: TypeId, elaborator: Array2<f32>, ctxt: &'a Context, ) -> SampledEmbeddingSpace<'a>
Creates a new, initially-empty SampledEmbeddingSpace.