OutputPrecedence

Trait OutputPrecedence 

Source
pub trait OutputPrecedence {
    // Required method
    fn key_precedence(&self) -> impl Iterator<Item = &OutputKey>;
}
Expand description

Trait for defining a precedence of keys in the output.

This defines the order of precedence for selecting the output from the session outputs. By convention, an ONNX model will have at least one output called last_hidden_state, which is however not guaranteed. This trait allows the user to define the order of precedence for selecting the output.

Any OutputPrecedence should be usable multiple times, and should not consume itself; this is due to use of [rayon] parallelism, which means OutputPrecedence::key_precedence will have to be called once per batch.

Required Methods§

Source

fn key_precedence(&self) -> impl Iterator<Item = &OutputKey>

Get the precedence of the keys in the output.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl OutputPrecedence for &[OutputKey]

Any slices of OutputKey can be used as an OutputPrecedence.

Source§

fn key_precedence(&self) -> impl Iterator<Item = &OutputKey>

Implementors§