function binCount(data, bins) {
  return tf.tidy(() => {
    return tf.sum(
      tf.equal(
        // perform outer operations by expanding dimensions
        tf.expandDims(data, 1),
        bins
      ),
      0
    );
  });
}
@param {Array} data - 1-D array, each element is a bin id
@param {Number} bins - 1-D array representing bin indices
@return {Tensor1D} number of occurrences of bin indices, ordered by bin index