// layer_outputs = [func([model_inputs, 0.])[0] for func in funcs]
layer_outputs = [func(list_inputs)[0] for func in funcs]
for layer_activations in layer_outputs:
activations.append(layer_activations)
// if print_shape_only:
// print(layer_activations.shape)
// else:
// print(layer_activations)
After Change
layer.name == layer_name or layer_name is None] // all layer outputs
// we remove the placeholders (Inputs node in Keras). Not the most elegant though..
outputs = [output for output in outputs if "input_" not in output.name]
funcs = [K.function(inp + [K.learning_phase()], [out]) for out in outputs] // evaluation functions
if model_multi_inputs_cond:
list_inputs = []
list_inputs.extend(model_inputs)
list_inputs.append(0.)
else:
list_inputs = [model_inputs, 0.]
// Learning phase. 0 = Test mode (no dropout or batch normalization)
// layer_outputs = [func([model_inputs, 0.])[0] for func in funcs]
activations = [func(list_inputs)[0] for func in funcs]
layer_names = [output.name for output in outputs]
result = dict(zip(layer_names, activations))
return result
def display_activations(activations):