bunsen 0.34.1

bunsen is a batteries included common library for burn
Documentation
use burn::{
    Tensor,
    prelude::{
        Backend,
        TensorData,
    },
    tensor::TensorCreationOptions,
};

/// Trait defining an interface for building sampling windows.
pub trait SamplingWindowBuilder {
    /// Materialize a vector window of width `win_len`.
    fn to_vec_window(
        &self,
        size: usize,
    ) -> Vec<f64>;

    /// Materialize a tensor window of width `win_len`.
    fn to_tensor_window<B: Backend>(
        &self,
        size: usize,
        options: impl Into<TensorCreationOptions<B>>,
    ) -> Tensor<B, 1> {
        Tensor::from_data(
            TensorData::from(self.to_vec_window(size).as_slice()),
            options,
        )
    }
}