hamming_window

Function hamming_window 

pub fn hamming_window<B>(
    size: usize,
    periodic: bool,
    options: impl Into<TensorCreationOptions<B>>,
) -> Tensor<B, 1>
where B: Backend,
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_tensor::backend::Backend;
use burn_tensor::signal::hamming_window;

fn example<B: Backend>() {
    let device = B::Device::default();
    let window = hamming_window::<B>(8, true, &device);
    println!("{window}");
}