In Tensorflow, how to use tf.gather() for the last dimension?
<p>I am trying to gather slices of a tensor in terms of the last dimension for partial connection between layers. Because the output tensor's shape is <code>[batch_size, h, w, depth]</code>, I want to select slices based on the last dimension, such as</p>

<pre><code># L is intermediate tensor
partL = L[:, :, :, [0,2,3,8]]
</code></pre>

<p>However, <code>tf.gather(L, [0, 2,3,8])</code> seems to only work for the first dimension (right?) Can anyone tell me how to do it? </p>