title: K.function returns "TypeError: unhashable type: 'list' "
body: <p>I want to calculate the gradients of weights. I am using the following code:</p>
  
  <p>(assume that the <em>model</em> is already defined)</p>
  
  <p>(also both data and labels are fed as inputs)</p>
  
  <pre><code>weights = model.trainable_weights
  gradients = model.optimizer.get_gradients(model.total_loss, weights)
  input_tensors = [model.input, model.sample_weights, K.learning_phase() ]
  getGradients = K.function(inputs=input_tensors, outputs=gradients)
  sampleWeights = np.ones(len(image_data))
  inputs = [[image_data, labels], sampleWeights, 0 ]
  print getGradients(inputs)
  </code></pre>
  
  <p>This, however, returns the following error:
  <a href="https://i.stack.imgur.com/s8OLN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s8OLN.png" alt="enter image description here"></a></p>
  
  <p>I am using Keras(v2.0.6) with Tensorflow(v1.2.1) as backend.</p>
  
  <p>Also, is there any other way to do it without using K.function ? (I am new to Keras and Tensorflow).</p>