title: Slicing in keras Lambda doesn't work as expected
body: <p>I'm trying to pick out different parts of the input to be fed into different streams. Slicing works like this in numpy:</p>
  
  <pre><code>x = numpy.arange(10).reshape(-1,10)
  print(x[:, [1,2,3]])
  # &gt;&gt;&gt; [[1 2 3]]
  print(x[:, [2,5,9]])
  #&gt;&gt;&gt; [[2 5 9]]
  </code></pre>
  
  <p>But not for keras:</p>
  
  <pre><code>features = numpy.arange(10).reshape(-1, 10)
  
  inputs = keras.layers.Input(shape=(10,))
  predictions = keras.layers.Lambda(lambda x: x)(inputs)
  model = keras.models.Model(inputs=inputs, outputs=predictions)
  model.compile(loss='mean_squared_error', optimizer='adam')
  print(model.predict(features))
  # &gt;&gt;&gt; [[0. 1. 2. 3. 4. 5. 6. 7. 8. 9.]]
  
  
  inputs = keras.layers.Input(shape=(10,))
  predictions = keras.layers.Lambda(lambda x: x[:,1:3])(inputs)
  model = keras.models.Model(inputs=inputs, outputs=predictions)
  model.compile(loss='mean_squared_error', optimizer='adam')
  print(model.predict(features))
  # &gt;&gt;&gt; [[1. 2.]]
  
  inputs = keras.layers.Input(shape=(10,))
  predictions = keras.layers.Lambda(lambda x: x[:,[1,2,3]])(inputs)
  model = keras.models.Model(inputs=inputs, outputs=predictions)
  model.compile(loss='mean_squared_error', optimizer='adam')
  print(model.predictsn(features))
  # &gt;&gt;&gt; Traceback (most recent call last):
  #  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  #  File "/home/user/test.py", line 589, in &lt;module&gt;
  #    predictions = keras.layers.Lambda(lambda x: x[:,[1,2,3]])(inputs)
  #  File "/home/user/.local/lib/python3.6/site-packages/keras/engine/base_layer.py", line 451, in __call__
  #    output = self.call(inputs, **kwargs)
  #  File "/home/user/.local/lib/python3.6/site-packages/keras/layers/core.py", line 716, in call
  #    return self.function(inputs, **arguments)
  #  File "/home/user/test.py", line 589, in &lt;lambda&gt;
  #    predictions = keras.layers.Lambda(lambda x: x[:,[1,2,3]])(inputs)
  #  File "/home/user/.local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 491, in _slice_helper
  #    end.append(s + 1)
  #TypeError: can only concatenate list (not "int") to list
  
  inputs = keras.layers.Input(shape=(10,))
  predictions = keras.layers.Lambda(lambda x: tf.gather_nd(x, [1,2,3]))(inputs)
  model = keras.models.Model(inputs=inputs, outputs=predictions)
  model.compile(loss='mean_squared_error', optimizer='adam')
  print(model.predict(features))
  #&gt;&gt;&gt; Traceback (most recent call last):
  #  File "/home/user/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1628, in _create_c_op
  #    c_op = c_api.TF_FinishOperation(op_desc)
  #tensorflow.python.framework.errors_impl.InvalidArgumentError: indices.shape[-1] must be &lt;= params.rank, but saw indices shape: [3] and params shape: [?,10] for 'lambda_28/GatherNd' (op: 'GatherNd') with input shapes: [?,10], [3].
  
  
  &gt;&gt;&gt; tf.__version__
  '1.12.0'
  </code></pre>
  
  <p>What sort of details would the stackoverflow robot like me to add to make this question contain less code? Should I remove the parts where I tried things and the errors that I got so that somebody can ask me for them as clarifications?</p>