pub trait Transformer {
    // Required method
    fn transform_to_vec(&self) -> Vec<f32>;

    // Provided methods
    fn transform(
        &self,
        shape: &[usize]
    ) -> Result<SharedTensor<f32>, TransformerError> { ... }
    fn write_to_memory<T: NumCast + Copy>(
        mem: &mut FlatBox,
        data: &[T]
    ) -> Result<(), TransformerError> { ... }
    fn write_to_memory_offset<T: NumCast + Copy>(
        mem: &mut FlatBox,
        data: &[T],
        offset: usize
    ) -> Result<(), TransformerError> { ... }
}
Expand description

The Transformer Trait

Gets implemented for all Transformable Data Types. Allows all Transformable Data Types to get transformed into a Blob.

Required Methods§

source

fn transform_to_vec(&self) -> Vec<f32>

Transforms the non-numeric data into a numeric Vec

Provided Methods§

source

fn transform( &self, shape: &[usize] ) -> Result<SharedTensor<f32>, TransformerError>

Transforms non-numeric data into a numeric SharedTensor

The shape attribute is used to control the dimensions/shape of the Blob. It returns an Error, when the expected capacity (defined by the shape) differs from the observed one.

source

fn write_to_memory<T: NumCast + Copy>( mem: &mut FlatBox, data: &[T] ) -> Result<(), TransformerError>

Write into a native Coaster Memory.

source

fn write_to_memory_offset<T: NumCast + Copy>( mem: &mut FlatBox, data: &[T], offset: usize ) -> Result<(), TransformerError>

Write into a native Coaster Memory with a offset.

Object Safety§

This trait is not object safe.

Implementors§