Operator ShiftLeft

Operator Library: Arithmetics

该算子对输入数据执行向左的算术移位操作。 要移位的位数通过参数 Shift 进行定义。 输入端的每个位都向左移动参数指定的位数。新插入的最低有效位的值将 为零。

位移通常用于按 2 的幂次缩放值。 例如,向左移位一位会使该值加倍。 向左移位 2 位会使输入值变为原来的四倍。

每个颜色分量均单独进行移位。

I/O Property

Property 值
Operator Type O
Input Link I,数据输入
Output Link O,数据输出

Supported Link Format

Link Parameter Input Link I Output Link O
Bit Width [1, 64] 无符号,[2, 64] 有符号 auto1
Arithmetic {unsigned, signed} as I
Parallelism any as I
Kernel Columns any as I
Kernel Rows any as I
Img Protocol {VALT_IMAGE2D, VALT_LINE1D, VALT_PIXEL0D} as I
Color Format any as I
Color Flavor any as I
Max. Img Width any as I
Max. Img Height any as I

1

输出端的 Bit Width 是输入 Bit Width 加上参数 Shift 的值。

参数

Shift
键入 static 参数
默认 0
范围 [0, 64 - Input BitWidth]

该参数定义了输入向左移位的位数。

使用示例

以下示例展示了算子 ShiftLeft 的使用方法: