jax.pallas.tpu_sc.all_reduce_population_count

jax.pallas.tpu_sc.all_reduce_population_count#

jax.pallas.tpu_sc.all_reduce_population_count(x, *, reduce=1)[source]#

Computes the number of nonzero elements in the array.

Parameters:
  • x (Array) – A 1D array of bools.

  • reduce (int) – The factor to reduce the output shape by.

Returns:

An array with each element containing the number of true elements in x.

Return type:

Array