Trait greenglas::transformer::Transformer
[−]
[src]
pub trait Transformer { fn transform_to_vec(&self) -> Vec<f32>; 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> { ... } }
The Transformer Trait
Gets implemented for all Transformable Data Types.
Allows all Transformable Data Types to get transformed into a Blob
.
Required Methods
fn transform_to_vec(&self) -> Vec<f32>
Transforms the non-numeric data into a numeric Vec
Provided Methods
fn transform(
&self,
shape: &[usize]
) -> Result<SharedTensor<f32>, TransformerError>
&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.
fn write_to_memory<T: NumCast + Copy>(
mem: &mut FlatBox,
data: &[T]
) -> Result<(), TransformerError>
mem: &mut FlatBox,
data: &[T]
) -> Result<(), TransformerError>
Write into a native Coaster Memory.
fn write_to_memory_offset<T: NumCast + Copy>(
mem: &mut FlatBox,
data: &[T],
offset: usize
) -> Result<(), TransformerError>
mem: &mut FlatBox,
data: &[T],
offset: usize
) -> Result<(), TransformerError>
Write into a native Coaster Memory with a offset.