title: How to count elements in tensorflow tensor?
body: <p>I have a tensor for example : <code>X = [1, 1, 0, 0, 1, 2, 2, 0, 1, 2]</code>. </p>
  
  <p>And what I want is to reduce this tensor <code>X</code> to a tensor such as: <code>Y = [3, 4, 3]</code>. </p>
  
  <p>Where <code>Y</code> in position 0 is the count of how many 0s there are in <code>X</code>, and the position 1 how many 1s, so on and so forth. </p>
  
  <p>What I'm doing right now is iterating through this tensor using the <code>tf.where</code> function. But this doesn`t seem elegant, and there must be a better way to do it.</p>
  
  <p>Thanks.</p>