vec_not

Description

Performs bitwise NOT element-wise:

Prototype

vec_not(mask, dst, src, repeat_times, dst_rep_stride, src_rep_stride)

Parameters

For details, see Parameters.

dst and src must have the same data type.

Atlas 200/300/500 Inference Product : Tensors of type uint16 or int16

Atlas Training Series Product : Tensors of type uint16 or int16

Returns

None

Applicability

Atlas 200/300/500 Inference Product

Atlas Training Series Product

Restrictions

For details, see Restrictions.

Example

This example applies to a small amount of data that can be moved at a time, helping you understand the API functions. For more complex samples with a large amount of data, see Example.

from tbe import tik
tik_instance = tik.Tik()
src_gm = tik_instance.Tensor("int16", (128,), name="src_gm", scope=tik.scope_gm)
dst_gm = tik_instance.Tensor("int16", (128,), name="dst_gm", scope=tik.scope_gm)
src_ub = tik_instance.Tensor("int16", (128,), name="src_ub", scope=tik.scope_ubuf)
dst_ub = tik_instance.Tensor("int16", (128,), name="dst_ub", scope=tik.scope_ubuf)
# Move the user input from the Global Memory to the Unified Buffer.
tik_instance.data_move(src_ub, src_gm, 0, 1, 8, 0, 0)
tik_instance.vec_not(128, dst_ub, src_ub, 1, 8, 8)
# Move the compute result from the Unified Buffer to the destination Global Memory.
tik_instance.data_move(dst_gm, dst_ub, 0, 1, 8, 0, 0)

tik_instance.BuildCCE(kernel_name="vec_not", inputs=[src_gm], outputs=[dst_gm])

Result example:

Input (src_gm):
[ 9 -2  8  3  5  5 -3 -3  8 -6  2  7 -4 -6 -4 -3 -9  8  6  5 -8 -8  9  0
 -4 -8 -7  5 -9  7 -5 -5  4  6  7 -1  9  1  5  2 -1 -4  8 -2  6  2 -3  8
 -2 -9  0 -6  0  9  0  1  2  1  1 -4  9 -3 -6  9  5 -2  6  4 -5 -7 -7 -6
  6 -3  0  3  8  0  5  9  2 -7 -8  0  6  9  9 -3 -3 -7  3  8  9 -7  8  3
  2  3 -8  0  9  0  6 -9  8 -9  1 -2 -5 -3 -8  0  7 -9 -1  7 -1  0 -3  1
  1  9 -1  6 -9 -2  9  0]

Output (dst_gm):
[-10   1  -9  -4  -6  -6   2   2  -9   5  -3  -8   3   5   3   2   8  -9
  -7  -6   7   7 -10  -1   3   7   6  -6   8  -8   4   4  -5  -7  -8   0
 -10  -2  -6  -3   0   3  -9   1  -7  -3   2  -9   1   8  -1   5  -1 -10
  -1  -2  -3  -2  -2   3 -10   2   5 -10  -6   1  -7  -5   4   6   6   5
  -7   2  -1  -4  -9  -1  -6 -10  -3   6   7  -1  -7 -10 -10   2   2   6
  -4  -9 -10   6  -9  -4  -3  -4   7  -1 -10  -1  -7   8  -9   8  -2   1
   4   2   7  -1  -8   8   0  -8   0  -1   2  -2  -2 -10   0  -7   8   1
 -10  -1]