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§
Required Methods§
Sourcefn plan(
ctx: &mut Self::Context,
desc: &MetadataPrimsDescriptor,
inputs: &[MetadataTensorRef<'_>],
output: MetadataTensorMut<'_>,
) -> Result<Self::Plan>
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.
Sourcefn execute(
ctx: &mut Self::Context,
plan: &Self::Plan,
inputs: &[MetadataTensorRef<'_>],
output: MetadataTensorMut<'_>,
) -> Result<()>
fn execute( ctx: &mut Self::Context, plan: &Self::Plan, inputs: &[MetadataTensorRef<'_>], output: MetadataTensorMut<'_>, ) -> Result<()>
Execute a previously planned metadata-family operation in overwrite mode.
Sourcefn has_metadata_support(desc: MetadataPrimsDescriptor) -> bool
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§
Source§impl TensorMetadataPrims for CpuBackend
impl TensorMetadataPrims for CpuBackend
type Plan = MetadataPrimsDescriptor
type Context = CpuContext
Source§impl TensorMetadataPrims for CudaBackend
Available on non-crate feature cuda only.
impl TensorMetadataPrims for CudaBackend
Available on non-crate feature
cuda only.