计算输入tensor中每个元素二进制的1比特数量。
input_x (Tensor) - 输入tensor。
Tensor
Ascend GPU CPU
Ascend
GPU
CPU
样例:
>>> import mindspore >>> input_x = mindspore.tensor([0, 1, 3], mindspore.int16) >>> output = mindspore.ops.population_count(input_x) >>> print(output) [0 1 2]