docs: def reduce_cpu(f, x, axes, dtype):
      """NumPy's reduce in terms of fold."""
      axes = _get_axes(axes, x.ndim)
      if not axes:
          return x
  
      permute = [n for n in range(x.ndim) if n not in axes]
      permute = axes + permute
  
      T = x.transpose(permute=permute)
  
      N = len(axes)
      t = T.type.at(N, dtype=dtype)
      acc = x.empty(t, device=x.device)
  
      if f.identity is not None:
          _copyto(acc, f.identity)
          tl = T
      elif N == 1 and T.type.shape[0] > 0:
          hd, tl = T[0], T[1:]
          acc[()] = hd
      else:
          raise ValueError(
              "reduction not possible for function without an identity element")
  
      return fold(f, acc, tl)