Skip to main content

hann_window

Function hann_window 

pub fn hann_window(
    size: usize,
    periodic: bool,
    options: impl Into<TensorCreationOptions>,
) -> Tensor<1>
Expand description

Creates a 1D Hann window.

w_n = 0.5 - 0.5 * cos(2πn/N) where N = size (periodic) or N = size-1 (symmetric)

§Notes

  • size == 0 returns an empty tensor.
  • size == 1 returns [1.0] regardless of periodic.

§Example

use burn_core::tensor::Device;
use burn_signal::hann_window;

let device = Default::default();
let window = hann_window(8, true, &device);
println!("{window}");