Update visualize_util

This commit is contained in:
fchollet 2016-03-10 20:49:01 -08:00
parent bde45eff87
commit ef1e959505
3 changed files with 11 additions and 2 deletions

@ -10,6 +10,11 @@ from keras.utils.visualize_util import plot
plot(model, to_file='model.png')
```
`plot` takes two optional arguments:
- `recursive` (defaults to True) controls whether we recursively explore container layers.
- `show_shape` (defaults to False) controls whether output shapes are shown in the graph.
You can also directly obtain the `pydot.Graph` object and render it yourself,
for example to show it in an ipython notebook :
```python

@ -1722,6 +1722,10 @@ class Siamese(Layer):
self.constraints.append(c)
super(Siamese, self).__init__()
@property
def input_shape(self):
return [layer.output_shape for layer in self.inputs]
@property
def output_shape(self):
if self.merge_mode is None:

@ -149,6 +149,6 @@ def to_graph(model, **kwargs):
return ModelToDot()(model, **kwargs)
def plot(model, to_file='model.png'):
graph = to_graph(model)
def plot(model, to_file='model.png', **kwargs):
graph = to_graph(model, **kwargs)
graph.write_png(to_file)