汉明窗¶
汉明窗 - 17¶
版本¶
域:
main
自版本:
17
函数:
True
支持级别:
SupportType.COMMON
形状推断:
True
此版本的运算符已自版本 17起可用。
摘要¶
根据论文 https://ieeexplore.ieee.org/document/1455106 中的描述生成汉明窗。
函数体¶
此运算符的函数定义。
<
domain: "",
opset_import: ["" : 17]
>
HammingWindow <periodic,output_datatype>(size) => (output)
{
A0 = Constant <value: tensor = float {0.543478}> ()
A1 = Constant <value: tensor = float {0.456522}> ()
A2 = Constant <value: tensor = float {0}> ()
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)
}
属性¶
output_datatype - INT (默认值为
'1'
)输出张量的类型。严格必须是 TensorProto 中 DataType 枚举值之一,其值对应于 T2。默认值为 1 = FLOAT。
periodic - INT (默认值为
'1'
)如果为 1,则返回一个窗口,用作周期性函数。如果为 0,则返回一个对称窗口。当指定“periodic”时,hann 计算长度为 size + 1 的窗口,并返回前 size 个点。默认值为 1。
输入¶
size (异构) - T1
一个标量值,指示窗口的长度。
输出¶
output (异构) - T2
长度为 size 的汉明窗。输出形状为:[size]。
类型约束¶
T1 in (
tensor(int32)
,tensor(int64)
)将输入大小限制为 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)
)将输出类型限制为数字张量。