Operator Library: Arithmetics
TAN 算子用于计算输入的正切值。
正切函数的输入范围为 [-\u221e, \u221e]。 \t\t\t由于正切函数的周期性,VisualApplets 算子的输入范围被限制在 [-\u03c0, \u03c0[ \t\t\t即输入的最小值为 -\u03c0,输入的最大值加 1 为 \u03c0。 \t\t\t因此,输入端不可能出现 +\u03c0 的值。
因此,正切函数的自变量 x 由下式决定:

其中

是输入 link 上的 Bit Width。
正切函数的计算结果范围为 [-\u221e, \u221e]。 \t\t\t该算子包含一个参数 ResolutionBits,用于定义输出值的定点分辨率位数。 \t\t\t因此,输出范围由输出位数和分辨率位数共同决定 =

其中

是输出的 Bit Width,R 是分辨率位。 因此,输出值为

-$\u03c0$/2 和 $\u03c0$/2 的值对正切函数而言未定义。 \t\t\tVisualApplets 算子会将这些值裁切为输出端可能的最大值或最小值。 \t\t\t此外,正切函数的计算结果可能会超出输出值的范围。 \t\t\t在这种情况下,结果同样会被裁切为最大或可能的最极限值。 \t\t\t因此,

下图显示了普通正切函数的曲线图。

下一图表展示了 VisualApplets operator 的实现。请注意输入和输出的 Bit Width。

| Link Parameter | Input Link I | Output Link O |
|---|---|---|
| Bit Width | [8, 12] | [8,32] |
| Arithmetic | signed | signed |
| Parallelism | any | as I |
| Kernel Columns | 1 | as I |
| Kernel Rows | 1 | as I |
| Img Protocol | {VALT_IMAGE2D, VALT_LINE1D, VALT_PIXEL0D} | as I |
| Color Format | VAF_GRAY | as I |
| Color Flavor | FL_NONE | as I |
| Max. Img Width | any | as I |
| Max. Img Height | any | as I |
以下示例展示了 TAN 算子的使用方法:

上一页

