TensorMetadataPrims

Trait TensorMetadataPrims 

Source
pub trait TensorMetadataPrims {
    type Plan;
    type Context;

    // Required methods
    fn plan(
        ctx: &mut Self::Context,
        desc: &MetadataPrimsDescriptor,
        inputs: &[MetadataTensorRef<'_>],
        output: MetadataTensorMut<'_>,
    ) -> Result<Self::Plan>;
    fn execute(
        ctx: &mut Self::Context,
        plan: &Self::Plan,
        inputs: &[MetadataTensorRef<'_>],
        output: MetadataTensorMut<'_>,
    ) -> Result<()>;
    fn has_metadata_support(desc: MetadataPrimsDescriptor) -> bool;
}
Expand description

Metadata tensor planning and execution protocol.

Metadata execution is overwrite-based and uses erased integer/bool metadata tensor handles instead of scalar-family alpha / beta scaling.

§Examples

use tenferro_prims::{
    MetadataGenerateOp, MetadataPrimsDescriptor, MetadataTensorMut,
    MetadataTensorRef, TensorMetadataPrims,
};

fn accepts_family<F: TensorMetadataPrims>(_: &F) {}

let _ = MetadataPrimsDescriptor::Generate {
    op: MetadataGenerateOp::IotaStartZero,
    output_dtype: tenferro_prims::MetadataDType::I32,
};

Required Associated Types§

Source

type Plan

Backend plan type.

Source

type Context

Backend execution context.

Required Methods§

Source

fn plan( ctx: &mut Self::Context, desc: &MetadataPrimsDescriptor, inputs: &[MetadataTensorRef<'_>], output: MetadataTensorMut<'_>, ) -> Result<Self::Plan>

Plan a metadata-family operation for the given input and output tensor handles.

Source

fn execute( ctx: &mut Self::Context, plan: &Self::Plan, inputs: &[MetadataTensorRef<'_>], output: MetadataTensorMut<'_>, ) -> Result<()>

Execute a previously planned metadata-family operation in overwrite mode.

Source

fn has_metadata_support(desc: MetadataPrimsDescriptor) -> bool

Report whether the backend advertises support for the given descriptor.

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.

Implementors§