pub struct RelationNetModel { /* private fields */ }Expand description
Relation Networks: a learned embedding plus a relation score.
Implementations§
Source§impl RelationNetModel
impl RelationNetModel
Sourcepub fn new(config: &MetaLearningConfig) -> Result<Self, TrustformersError>
pub fn new(config: &MetaLearningConfig) -> Result<Self, TrustformersError>
Build the model from a meta-learning configuration.
Sourcepub fn learner(&self) -> &MlpLearner
pub fn learner(&self) -> &MlpLearner
Immutable access to the underlying learner.
Trait Implementations§
Source§impl Clone for RelationNetModel
impl Clone for RelationNetModel
Source§impl Debug for RelationNetModel
impl Debug for RelationNetModel
Source§impl MetaLearningModel for RelationNetModel
impl MetaLearningModel for RelationNetModel
fn forward(&mut self, examples: &ExampleSet) -> Result<f64, TrustformersError>
fn compute_accuracy( &self, examples: &ExampleSet, ) -> Result<f64, TrustformersError>
fn compute_gradients( &self, loss: f64, ) -> Result<ModelGradients, TrustformersError>
fn apply_gradients( &mut self, gradients: &ModelGradients, lr: f64, ) -> Result<(), TrustformersError>
fn get_parameters(&self) -> Result<ModelParameters, TrustformersError>
fn set_parameters( &mut self, params: ModelParameters, ) -> Result<(), TrustformersError>
fn embed(&self, example: &Example) -> Result<Tensor, TrustformersError>
fn compute_relation( &self, a: &Tensor, b: &Tensor, ) -> Result<f64, TrustformersError>
fn compute_second_order_gradients( &self, _initial_params: &ModelParameters, _loss: f64, ) -> Result<ModelGradients, TrustformersError>
fn compute_first_order_gradients( &self, _loss: f64, ) -> Result<ModelGradients, TrustformersError>
fn write_to_memory( &mut self, _example: &Example, ) -> Result<(), TrustformersError>
fn read_from_memory( &self, _example: &Example, ) -> Result<MemoryOutput, TrustformersError>
fn predict_from_memory( &self, _memory_output: &MemoryOutput, ) -> Result<MemoryPrediction, TrustformersError>
fn clear_memory(&mut self) -> Result<(), TrustformersError>
fn get_learning_rates(&self) -> Result<Vec<f64>, TrustformersError>
fn apply_gradients_with_lr( &mut self, _gradients: &ModelGradients, _learning_rates: &[f64], ) -> Result<(), TrustformersError>
fn compute_lr_gradients( &self, _loss: f64, ) -> Result<Vec<f64>, TrustformersError>
fn get_meta_learner_state(&self) -> Result<MetaLearnerState, TrustformersError>
fn apply_learned_algorithm( &self, _support_set: &ExampleSet, _state: &MetaLearnerState, ) -> Result<ModelParameters, TrustformersError>
fn evaluate_with_params( &self, _examples: &ExampleSet, _params: &ModelParameters, ) -> Result<f64, TrustformersError>
fn compute_accuracy_with_params( &self, _examples: &ExampleSet, _params: &ModelParameters, ) -> Result<f64, TrustformersError>
fn compute_meta_learner_gradients( &self, _loss: f64, ) -> Result<ModelGradients, TrustformersError>
fn get_lstm_state(&self) -> Result<LSTMState, TrustformersError>
fn lstm_update( &self, _gradients: &ModelGradients, _state: &LSTMState, _step: usize, ) -> Result<(ModelUpdates, LSTMState), TrustformersError>
fn apply_lstm_updates( &mut self, _updates: &ModelUpdates, ) -> Result<(), TrustformersError>
fn compute_lstm_gradients( &self, _loss: f64, ) -> Result<ModelGradients, TrustformersError>
Auto Trait Implementations§
impl Freeze for RelationNetModel
impl RefUnwindSafe for RelationNetModel
impl Send for RelationNetModel
impl Sync for RelationNetModel
impl Unpin for RelationNetModel
impl UnsafeUnpin for RelationNetModel
impl UnwindSafe for RelationNetModel
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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