Convert KerasModelWrapper fprop to _fprop.
@@ -183,16 +183,13 @@ class KerasModelWrapper(Model):
layer_names = [x.name for x in self.model.layers]
return layer_names
- def fprop(self, x):
+ def _fprop(self, x):
"""
Exposes all the layers of the model returned by get_layer_names.
:param x: A symbolic representation of the network input
:return: A dictionary mapping layer names to the symbolic
representation of their output.
"""
- if (x, self.state) in self.fprop_cache.keys():
- return self.fprop_cache[(x, self.state)]
- else:
from keras.models import Model as KerasModel
fprop_dict = {}
@@ -207,6 +204,4 @@ class KerasModelWrapper(Model):
# Add this layer's output tensor to the dictionary
fprop_dict[layer] = new_model(x)
- # Save to cache before returning
- self.fprop_cache[(x, self.state)] = fprop_dict
return fprop_dict
