title: Get the mask of a given tensor
body: <p>I have a tensor and I want to get the masked values in it to have the corresponding mask.</p>
  <p>input:
  <code>x1 = [[[0 0 0] [0 0 0] [1 1 1] [-1 -1 0]]]</code></p>
  <p>output mask of x1:
  <code>mask_1 =  [[0 0 1 1]]</code></p>
  <p>I want to do that in a few lines in Keras, what I have done so far is:</p>
  <pre><code>mask_3 = K.cast(tf.equal(x1, 0), 'float32')
  mask_4 = K.sum(K.ones_like(x1), axis=-1)        
  mask_5 = K.sum(mask_3, axis=-1)
  mask_6 = mask_5 &lt; mask_4
  </code></pre>
  <p>Is there a more efficient way?</p>