Repository: keras-team/keras

Issue:
How about a doc for keras model in general? e.g. model.summary()
https://keras.io/models/about-keras-models/

This page seems manually created rather than collected from the source file. Maybe we could add a bit more on this page? E.g., 
```
print_summary(model, line_length=None, positions=None, print_fn=print):
```
The arguments can be explained along with summary().


Discussion:
The `print_summary()` method is part of the Keras utilities (see [utils/layer_utils.py](https://github.com/fchollet/keras/blob/master/keras/utils/layer_utils.py)), so it would be expected to be documented on the [utils documentation page](https://keras.io/utils/) page, and not the Keras models page.

However, it is not included on that page because it is not imported in the [`utils/__init__.py`](https://github.com/fchollet/keras/blob/master/keras/utils/__init__.py). This only imports select utilities. These are the ones that are documented on the [utils documentation page](https://keras.io/utils/) (see, for example, [convert_all_kernels_in_model()](https://keras.io/utils/#convert_all_kernels_in_model) on the documentation page, which is imported on [line 20 of `utils/__init__.py`](https://github.com/fchollet/keras/blob/master/keras/utils/__init__.py#L20)).

If it were, the arguments would be extracted automatically from the Python docstrings, as they are for `convert_all_kernels_in_model()`.
This means your question is *really* why `print_summary()` is not included in `utils/__init__.py` - and I don't know the answer to that question.
`print_summary()` is, yes, layer utils, but I guess what people use more frequently is `model.summary()` and that's what I wanted to say. 
the `model.summary()` method is defined in `keras/engine/topology.py`, [line 2689](https://github.com/fchollet/keras/blob/master/keras/engine/topology.py#L2689), also not included in the documentation. The `model.summary()` documentation is included in [about-keras-models.md](https://github.com/fchollet/keras/blob/master/docs/templates/models/about-keras-models.md) in the documentation, which is _not_ automatically generated and does not include any information about its parameters or arguments.

Resolving this issue would involve adding argument information to `model.summary()` documentation in `about-keras-models.md` and submitting a pull request.
Exactly.

Resolving patch:
diff --git a/docs/autogen.py b/docs/autogen.py
--- a/docs/autogen.py
+++ b/docs/autogen.py
@@ -284,6 +284,7 @@
         'functions': [utils.to_categorical,
                       utils.normalize,
                       utils.get_file,
+                      utils.print_summary,
                       utils.plot_model,
                       utils.multi_gpu_model],
         'classes': [utils.CustomObjectScope,
@@ -360,7 +361,7 @@ def get_class_signature(cls):
     try:
         class_signature = get_function_signature(cls.__init__)
         class_signature = class_signature.replace('__init__', cls.__name__)
-    except TypeError:
+    except (TypeError, AttributeError):
         # in case the class inherits from object and does not
         # define __init__
         class_signature = cls.__module__ + '.' + cls.__name__ + '()'
@@ -406,8 +407,8 @@ def code_snippet(snippet):
 
 
 def process_class_docstring(docstring):
-    docstring = re.sub(r'\n    # (.*)\n',
-                       r'\n    __\1__\n\n',
+    docstring = re.sub(r'\n(\s+)# (.*)\n',
+                       r'\n\1__\2__\n\n',
                        docstring)
     docstring = re.sub(r'    ([^\s\\\(]+):(.*)\n',
                        r'    - __\1__:\2\n',
@@ -420,8 +421,8 @@ def process_class_docstring(docstring):
 
 
 def process_function_docstring(docstring):
-    docstring = re.sub(r'\n    # (.*)\n',
-                       r'\n    __\1__\n\n',
+    docstring = re.sub(r'\n(\s+)# (.*)\n',
+                       r'\n\1__\2__\n\n',
                        docstring)
     docstring = re.sub(r'    ([^\s\\\(]+):(.*)\n',
                        r'    - __\1__:\2\n',
diff --git a/keras/utils/__init__.py b/keras/utils/__init__.py
--- a/keras/utils/__init__.py
+++ b/keras/utils/__init__.py
@@ -18,6 +18,7 @@
 from .generic_utils import deserialize_keras_object
 from .generic_utils import Progbar
 from .layer_utils import convert_all_kernels_in_model
+from .layer_utils import print_summary
 from .vis_utils import plot_model
 from .np_utils import to_categorical
 from .np_utils import normalize


Test patch: