ValuesCollectExt

Trait ValuesCollectExt 

Source
pub trait ValuesCollectExt: Iterator<Item = f32> + Sized {
    // Required method
    fn collect_shape(self, dims: Vec<usize>) -> Tensor;
}
Expand description

Extension trait to collect Iterator<Item=f32> directly into a shaped Tensor

This trait is automatically implemented for any Iterator<Item = f32>, so you can call collect_shape() directly on iterators yielding f32 values without importing the trait.

Required Methods§

Source

fn collect_shape(self, dims: Vec<usize>) -> Tensor

Collect f32 values from this iterator into a tensor with the specified shape

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<I> ValuesCollectExt for I
where I: Iterator<Item = f32> + Sized,