title: TypeError: Tensor is unhashable. Instead, use tensor.ref() as the key. in Keras Surgeon
body: <p>I'm using Kerassurgeon module for pruning.I encountered this error while i'm working with VGG-16 in google colab.It works fine for other models.Can someone help me fix this.</p>
  
  <pre><code>---&gt; 17   model_new = surgeon.operate()&lt;br&gt;
       18   return model_new
  
  &gt;&gt;/usr/local/lib/python3.6/dist-packages/kerassurgeon/surgeon.py in operate(self)
      152             sub_output_nodes = utils.get_node_inbound_nodes(node)
      153             outputs, output_masks = self._rebuild_graph(self.model.inputs,
  --&gt; 154                                                         sub_output_nodes)
      155 
      156             # Perform surgery at this node
  
  &gt;&gt;/usr/local/lib/python3.6/dist-packages/kerassurgeon/surgeon.py in _rebuild_graph(self, graph_inputs, output_nodes, graph_input_masks)
      264         # Call the recursive _rebuild_rec method to rebuild the submodel up to
      265         # each output layer
  --&gt; 266         outputs, output_masks = zip(*[_rebuild_rec(n) for n in output_nodes])
      267         return outputs, output_masks
      268 
  
  &gt;&gt;/usr/local/lib/python3.6/dist-packages/kerassurgeon/surgeon.py in &lt;listcomp&gt;(.0)
      264         # Call the recursive _rebuild_rec method to rebuild the submodel up to
      265         # each output layer
  --&gt; 266         outputs, output_masks = zip(*[_rebuild_rec(n) for n in output_nodes])
      267         return outputs, output_masks
      268 
  
  &gt;&gt;/usr/local/lib/python3.6/dist-packages/kerassurgeon/surgeon.py in _rebuild_rec(node)
      216             # Check for replaced tensors before any other checks:
      217             # these are created by the surgery methods.
  --&gt; 218             if node_output in self._replace_tensors.keys():
      219                 logging.debug('bottomed out at replaced output: {0}'.format(
      220                     node_output))
  
  &gt;&gt;/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in __hash__(self)
      724     if (Tensor._USE_EQUALITY and executing_eagerly_outside_functions() and
      725         (g is None or g.building_function)):
  --&gt; 726       raise TypeError("Tensor is unhashable. "
      727                       "Instead, use tensor.ref() as the key.")
      728     else:
  
  **TypeError: Tensor is unhashable. Instead, use tensor.ref() as the key.**
  </code></pre>