(l-onnx-doc-BlackmanWindow)= # BlackmanWindow (l-onnx-op-blackmanwindow-17)= ## BlackmanWindow - 17 ### Version - **name**: [BlackmanWindow (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#BlackmanWindow) - **domain**: `main` - **since_version**: `17` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 17**. ### Summary Generates a Blackman window as described in the paper https://ieeexplore.ieee.org/document/1455106. #### Function Body The function definition for this operator. ``` < domain: "", opset_import: ["" : 17] > BlackmanWindow <periodic,output_datatype>(size) => (output) { A0 = Constant <value: tensor = float {0.42}> () A1 = Constant <value: tensor = float {0.5}> () A2 = Constant <value: tensor = float {0.08}> () Zero = Constant <value: tensor = float {0}> () One = Constant <value: tensor = float {1}> () Two = Constant <value: tensor = float {2}> () Tau = Constant <value: tensor = float {6.28319}> () Periodic_Size_FP = Cast <to: int = 1> (size) Symmetric_Size_FP = Sub (Periodic_Size_FP, One) IsPeriodic = Constant <value_int: int = @periodic> () IsPeriodic_FP = Cast <to: int = 1> (IsPeriodic) IsSymmetric_FP = Sub (One, IsPeriodic_FP) Periodic_Component = Mul (Periodic_Size_FP, IsPeriodic_FP) Symmetric_Component = Mul (Symmetric_Size_FP, IsSymmetric_FP) Size_FP = Add (Periodic_Component, Symmetric_Component) AngularIncrement = Div (Tau, Size_FP) Range = Range (Zero, Periodic_Size_FP, One) RangeAngular = Mul (Range, AngularIncrement) TwoRangeAngular = Mul (RangeAngular, Two) CosTwoRangeAngular = Cos (TwoRangeAngular) A2_Component = Mul (A2, CosTwoRangeAngular) CosRangeAngular = Cos (RangeAngular) A1_Component = Mul (A1, CosRangeAngular) Temp0 = Sub (A0, A1_Component) Temp1 = Add (Temp0, A2_Component) output = Cast <to: int = @output_datatype> (Temp1) } ``` ### Attributes * **output_datatype - INT** (default is `'1'`): 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** (default is `'1'`): 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**: A scalar value indicating the length of the window. ### Outputs - **output** (heterogeneous) - **T2**: A Blackman window with length: size. The output has the shape: [size]. ### Type Constraints * **T1** in ( `tensor(int32)`, `tensor(int64)` ): Constrain the input size to int32_t or 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.