jax.lax.population_count#

jax.lax.population_count(x)[source]#

Elementwise popcount, count the number of set bits in each element.

This function lowers directly to the stablehlo.popcnt operation.

Parameters:

x (ArrayLike) – Input array. Must have integer dtype.

Returns:

An array of the same shape and dtype as x, containing the number of set bits in the input.

Return type:

Array

See also