Skip to main content

hamming_window

Function hamming_window 

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

Creates a 1D Hamming window.

w_n = 25/46 - 21/46 * 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::hamming_window;

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