title: tensorflow assign values of 2D tensor by indices when 1st dimension of the tensor is unknown [in keras.layers.Layer]
body: <p>I am implementing a keras layer, and its <code>call</code> function needs to achieve 2D Tensor value assign by indices. The function is demonstrated by python numpy as follows:</p>
  
  <pre><code>import numpy as np
  A = np.arange(12).reshape(6,2)
  ind_x = [2,4,5]
  ind_y = [0,1,0]
  A[(ind_x,ind_y)] = -1 # assign value 
  A = array([[ 0,  1],
             [ 2,  3],
             [-1,  5],
             [ 6,  7],
             [ 8, -1],
             [-1, 11]])
  </code></pre>
  
  <p>If <code>A.shape = (6,2)</code> is available, then <code>tf.SparseTensor</code> is perfect for this purpose. </p>
  
  <p>However in my case, A is the input of keras.layers.Layer, thus its first dimension (i.e. batch size) is undetermined during graph construction. In the end, <code>A.shape = (None,2)</code>. Is there any other tensorflow function can achieve this? Thanks.</p>
  
  <p>P.S. A question was asked with full keras implementation <a href="https://stackoverflow.com/questions/52640036/keras-with-tensorflow-backend-layer-implementation-when-batch-size-is-used-but">here</a>. However, I think the question might be clearer and more fundamental here.</p>