Skip to main content

Composable

Trait Composable 

Source
pub trait Composable<T, B: Backend>: Operand<T, B> { }
Expand description

A subset of all tensor types that can be materialized

A “materializable” subset of Operand: values that are legal as concrete inputs when binding a skeleton via compose. SkeletonSlot and SkeletonPromise are Operands but not Composable. This exclusion guarantees that no unbound slot appears in the materialization path.

§Examples

use candela::skeleton::SkeletonSlot;
use candela::Tensor;

let x = SkeletonSlot::from_shape(&[4]);
let sk = (&x * 2.0).into_skeleton(&[x])?;

// `compose` accepts any `Composable` - a Tensor or a TensorPromise - but not a slot.
let as_tensor = Tensor::from_scalar(3.0, &[4]);
let as_promise = Tensor::from_scalar(3.0, &[4]) + 1.0;
sk.compose(&[&as_tensor])?;
sk.compose(&[&as_promise])?;

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T, B: Backend> Composable<T, B> for BakedPromise<T, B>

Source§

impl<T, B: Backend> Composable<T, B> for CachedTensorPromise<T, B>

Source§

impl<T, B: Backend> Composable<T, B> for Tensor<T, B>

Source§

impl<T, B: Backend> Composable<T, B> for TensorPromise<T, B>