Skip to main content

MetaObjective

Trait MetaObjective 

Source
pub trait MetaObjective<T: Float + Debug + Send + Sync + 'static> {
    // Required methods
    fn dimension(&self) -> usize;
    fn initial_parameters(&self) -> Array1<T>;
    fn loss_and_gradient(&self, params: &Array1<T>) -> Result<(T, Array1<T>)>;

    // Provided method
    fn name(&self) -> &str { ... }
}
Expand description

A differentiable task a learned optimizer can be meta-trained on.

Implementors must be cheap to evaluate: a meta-training run calls Self::loss_and_gradient on the order of population × iterations × tasks × horizon times.

Required Methods§

Source

fn dimension(&self) -> usize

Number of parameters the task optimizes over.

Source

fn initial_parameters(&self) -> Array1<T>

The point a rollout starts from. Must have length Self::dimension.

Source

fn loss_and_gradient(&self, params: &Array1<T>) -> Result<(T, Array1<T>)>

The loss and its gradient at params.

§Errors

Returns an error if params has the wrong length.

Provided Methods§

Source

fn name(&self) -> &str

A short human-readable name, for diagnostics.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T: Float + Debug + Send + Sync + 'static> MetaObjective<T> for QuadraticObjective<T>