Trait burn::train::metric::Metric

pub trait Metric: Send + Sync {
    type Input;

    const NAME: &'static str;

    // Required methods
    fn update(
        &mut self,
        item: &Self::Input,
        metadata: &MetricMetadata,
    ) -> MetricEntry;
    fn clear(&mut self);
}
Expand description

Metric trait.

§Notes

Implementations should define their own input type only used by the metric. This is important since some conflict may happen when the model output is adapted for each metric’s input type.

Required Associated Types§

type Input

The input type of the metric.

Required Associated Constants§

const NAME: &'static str

The name of the metric.

This should be unique, so avoid using short generic names, prefer using the long name.

Required Methods§

fn update( &mut self, item: &Self::Input, metadata: &MetricMetadata, ) -> MetricEntry

Update the metric state and returns the current metric entry.

fn clear(&mut self)

Clear the metric state.

Object Safety§

This trait is not object safe.

Implementors§

§

impl Metric for CpuMemory

§

const NAME: &'static str = "CPU Memory"

§

type Input = ()

§

impl Metric for CpuTemperature

§

const NAME: &'static str = "CPU Temperature"

§

type Input = ()

§

impl Metric for CpuUse

§

const NAME: &'static str = "CPU Usage"

§

type Input = ()

§

impl Metric for CudaMetric

§

const NAME: &'static str = "CUDA Stats"

§

type Input = ()

§

impl Metric for LearningRateMetric

§

const NAME: &'static str = "Learning Rate"

§

type Input = ()

§

impl<B> Metric for AccuracyMetric<B>
where B: Backend,

§

const NAME: &'static str = "Accuracy"

§

type Input = AccuracyInput<B>

§

impl<B> Metric for HammingScore<B>
where B: Backend,

§

const NAME: &'static str = "Hamming Score"

§

type Input = HammingScoreInput<B>

§

impl<B> Metric for LossMetric<B>
where B: Backend,

§

const NAME: &'static str = "Loss"

§

type Input = LossInput<B>

§

impl<B> Metric for TopKAccuracyMetric<B>
where B: Backend,

§

const NAME: &'static str = "Top-K Accuracy"

§

type Input = TopKAccuracyInput<B>