title: using tf.where() to select 3d tensor by 2d conditions & replacing elements in a 2d indices with keys and values
body: <p>There are 2 questions in the title. I am confused by both questions because tensorflow is such a static programming language (I really want to go back to either pytorch or chainer).</p>
  
  <p>I give 2 examples. please answer me in tensorflow codes or providing the relevant function links.</p>
  
  <p>1) tf.where()</p>
  
  <pre><code>data0 = tf.zeros([2, 3, 4], dtype = tf.float32)
  data1 = tf.ones([2, 3, 4], dtype = tf.float32)
  cond = tf.constant([[0, 1, 1], [1, 0, 0]])
  # cond.shape == (2, 3)
  # tf.where() works for 1d condition with 2d data, 
  # but not for 2d indices with 3d tensor
  # currently, what I am doing is:
  #    cond = tf.stack([cond] * 4, 2)
  data = tf.where(cond &gt; 0, data1, data0)
  # data should be [[0., 1., 1.], [1., 0., 0.]]
  </code></pre>
  
  <p>(I don't know how to broadcast cond to 3d tensor)</p>
  
  <p>2) change element in 2d tensor</p>
  
  <pre><code># all dtype == tf.int64
  t2d = tf.Variable([[0, 1, 2], [3, 4, 5]])
  k, v = tf.constant([[0, 2], [1, 0]]), tf.constant([-2, -3])
  # TODO: change values at positions k to v
  # I cannot do [t2d.copy()[i] = j for i, j in k, v]
  t3d == [[[0, 1, -2], [3, 4, 5]],
          [[0, 1, 2], [-3, 4, 5]]]
  </code></pre>
  
  <p>Thank you so much in advance. XD</p>