HannWindow#

HannWindow - 17#

Version

  • name: HannWindow (GitHub)

  • domain: main

  • since_version: 17

  • function:

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 17.

Summary

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.

Inputs

  • size (heterogeneous) - T1:

Outputs

  • output (heterogeneous) - T2:

Type Constraints

  • T1 in ( tensor(int32), tensor(int64) ): Constrain the input size to int64_t.

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

Examples

default

import numpy as np
import onnx

# Test periodic window
node = onnx.helper.make_node(
    "HannWindow",
    inputs=["x"],
    outputs=["y"],
)
size = np.int32(10)
a0 = 0.5
a1 = 0.5
y = a0 - a1 * np.cos(
    2 * 3.1415 * np.arange(0, size, 1, dtype=np.float32) / size
)
expect(node, inputs=[size], outputs=[y], name="test_hannwindow")

# Test symmetric window
node = onnx.helper.make_node(
    "HannWindow", inputs=["x"], outputs=["y"], periodic=0
)
size = np.int32(10)
a0 = 0.5
a1 = 0.5
y = a0 - a1 * np.cos(
    2 * 3.1415 * np.arange(0, size, 1, dtype=np.float32) / (size - 1)
)
expect(node, inputs=[size], outputs=[y], name="test_hannwindow_symmetric")