HannWindow#

  • Domain: ai.onnx

  • Since version: 17

Generates a Hann window as described in the paper https://ieeexplore.ieee.org/document/1455106.

Inputs

  • size (T1): A scalar value indicating the length of the window.

Outputs

  • output (T2): A Hann window with length: size. The output has the shape: [size].

Attributes

  • output_datatype (int): The data type of the output tensor. Strictly must be one of the values from DataType enum in TensorProto whose values correspond to T2. The default value is 1 = FLOAT.

  • periodic (int): If 1, returns a window to be used as periodic function. If 0, return a symmetric window. When ‘periodic’ is specified, hann computes a window of length size + 1 and returns the first size points. The default value is 1.

Type Constraints

  • T1: Constrain the input size to int32_t or int64_t. Allowed types: tensor(int32), tensor(int64).

  • T2: Constrain output types to numeric tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).

Examples#

test_cc_hannwindow

Node:
  HannWindow(x) -> (y)
Inputs:
  x: shape=(), dtype=int32
    10

Outputs:
  y: shape=(10,), dtype=float32
    [0.        , 0.09549151, 0.3454915 , 0.6545085 , 0.9045085 , 1.        ,
     0.9045085 , 0.6545085 , 0.3454915 , 0.09549151]

test_cc_hannwindow_bfloat16

Node:
  HannWindow(x) -> (y)
  Attributes:
    output_datatype = 16
    periodic = 1
Inputs:
  x: shape=(), dtype=int32
    32768

Outputs:
  y: shape=(32768,), dtype=bfloat16
    [0, 9.19681e-09, 3.67872e-08, ..., 8.28877e-08, 3.67872e-08, 9.19681e-09]

test_cc_hannwindow_bfloat16_symmetric

Node:
  HannWindow(x) -> (y)
  Attributes:
    output_datatype = 16
    periodic = 0
Inputs:
  x: shape=(), dtype=int32
    32768

Outputs:
  y: shape=(32768,), dtype=bfloat16
    [0, 9.19681e-09, 3.67872e-08, ..., 3.67872e-08, 9.19681e-09, 0]

test_cc_hannwindow_float16

Node:
  HannWindow(x) -> (y)
  Attributes:
    output_datatype = 10
    periodic = 1
Inputs:
  x: shape=(), dtype=int32
    32768

Outputs:
  y: shape=(32768,), dtype=float16
    [0.e+00, 0.e+00, 6.e-08, ..., 6.e-08, 6.e-08, 0.e+00]

test_cc_hannwindow_float16_symmetric

Node:
  HannWindow(x) -> (y)
  Attributes:
    output_datatype = 10
    periodic = 0
Inputs:
  x: shape=(), dtype=int32
    32768

Outputs:
  y: shape=(32768,), dtype=float16
    [0.e+00, 0.e+00, 6.e-08, ..., 6.e-08, 0.e+00, 0.e+00]

test_cc_hannwindow_int8

Node:
  HannWindow(x) -> (y)
  Attributes:
    output_datatype = 3
    periodic = 1
Inputs:
  x: shape=(), dtype=int32
    64

Outputs:
  y: shape=(64,), dtype=int8
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

test_cc_hannwindow_int8_symmetric

Node:
  HannWindow(x) -> (y)
  Attributes:
    output_datatype = 3
    periodic = 0
Inputs:
  x: shape=(), dtype=int32
    64

Outputs:
  y: shape=(64,), dtype=int8
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

test_cc_hannwindow_symmetric

Node:
  HannWindow(x) -> (y)
  Attributes:
    periodic = 0
Inputs:
  x: shape=(), dtype=int32
    10

Outputs:
  y: shape=(10,), dtype=float32
    [0.        , 0.11697778, 0.4131759 , 0.75      , 0.9698463 , 0.9698463 ,
     0.75      , 0.4131759 , 0.11697778, 0.        ]