title: How to apply mask to a tensor and keep its original shape
body: <p>I have two tensors: one containing data and the other mask of boolean values. I would like to set all values in data tensor to zero, if boolean values are False, while keeping the original shape of data tensor. 
  So far I can achieve it only while mask is a numpy array. </p>
  
  <p>Since <a href="https://www.tensorflow.org/api_docs/python/tf/boolean_mask" rel="nofollow noreferrer">https://www.tensorflow.org/api_docs/python/tf/boolean_mask</a> influences shape of the tensor, I cannot use it.</p>
  
  <p>How to do that?</p>
  
  <pre><code>import numpy as np
  import tensorflow as tf
  tf.enable_eager_execution()
  
  # create dummy data
  data_np = np.ones((4,2,3))
  mask_np = np.array([[True, True],[False, True],[True, True],[False, False]])
  
  # prepare tensors
  data = tf.convert_to_tensor(data_np)
  mask = tf.convert_to_tensor(mask_np)
  
  # how to perform the same while avoiding numpy?
  mask = np.expand_dims(mask, -1)
  data *= mask
  </code></pre>