Skip to main content

Instance

Trait Instance 

Source
pub trait Instance: Send + Sync {
    // Required method
    fn run(
        &self,
        ctx: &Context<'_>,
        inputs: &BTreeMap<String, Array>,
    ) -> Result<BTreeMap<String, Array>, Error>;

    // Provided methods
    fn linearize(
        &self,
        _ctx: &Context<'_>,
        _inputs: &BTreeMap<String, Array>,
    ) -> Result<Option<(BTreeMap<String, Array>, Box<dyn Linear + '_>)>, Error> { ... }
    fn as_any(&self) -> Option<&(dyn Any + 'static)> { ... }
}
Expand description

設定の決まったプラグイン(呼び出しの単位)

Required Methods§

Source

fn run( &self, ctx: &Context<'_>, inputs: &BTreeMap<String, Array>, ) -> Result<BTreeMap<String, Array>, Error>

入力から出力を作る(状態なし)

Provided Methods§

Source

fn linearize( &self, _ctx: &Context<'_>, _inputs: &BTreeMap<String, Array>, ) -> Result<Option<(BTreeMap<String, Array>, Box<dyn Linear + '_>)>, Error>

線形化: Instance::run と同じ出力と、入力の微分 1 方向から出力の微分を作る Linear。多くの方向の微分を 流すとき、解析を 1 回で済ませる口。既定は None(この口が無い。呼ぶ側は微分を run の入力に渡す)

Source

fn as_any(&self) -> Option<&(dyn Any + 'static)>

具体の型へ戻す口(上の層が、配列のほかに型の口を持つ実装を見分けて直接呼ぶ用)。既定は None

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Instance for Prepared

Source§

fn run( &self, ctx: &Context<'_>, inputs: &BTreeMap<String, Array>, ) -> Result<BTreeMap<String, Array>, Error>

Implementors§