We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
inconsistency to use example module
I found some inconsistent behavior to import classes.

To use SOME_CLASS in chainer/iterators, the following code works.
```importIterator.py
import chainer
some_class = chainer.iterators.SOME_CLASS() # OK
```
However, to use SOME_CLASS in chainer/training/extensions, the following code does not work.
```importExtension.py
import chainer
some_class = chainer.training.extensions.SOME_CLASS() #NG
```

I feel some inconsistency here, because `chainer/__init__.py` contains both of `import iterator` and `import iterators` but `chaner/training/__init__.py` contains only `import extension` and not `import extensions`.

Is there any reason about this inconsistency?

* Conditions
  - Chainer version
    chainer v2.0.1
  - OS/Platform
    ubuntu 16.04
* Code to reproduce
```importModule.py
import chainer
iteratorExamples = chainer.iterators # OK

import chainer
extensionExamples = chainer.training.extensions #NG
```

* Error messages
```error.py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'chainer.training' has no attribute 'extensions'
```




--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `chainer/training/__init__.py`
Content:
```
1 from chainer.training import extension  # NOQA
2 from chainer.training import trainer  # NOQA
3 from chainer.training import trigger  # NOQA
4 from chainer.training import updater  # NOQA
5 
6 
7 # import class and function
8 from chainer.training.extension import Extension  # NOQA
9 from chainer.training.extension import make_extension  # NOQA
10 from chainer.training.extension import PRIORITY_EDITOR  # NOQA
11 from chainer.training.extension import PRIORITY_READER  # NOQA
12 from chainer.training.extension import PRIORITY_WRITER  # NOQA
13 from chainer.training.trainer import Trainer  # NOQA
14 from chainer.training.trigger import get_trigger  # NOQA
15 from chainer.training.trigger import IntervalTrigger  # NOQA
16 from chainer.training.updater import ParallelUpdater  # NOQA
17 from chainer.training.updater import StandardUpdater  # NOQA
18 from chainer.training.updater import Updater  # NOQA
19
```

Path: `chainer/training/extensions/parameter_statistics.py`
Content:
```
1 import numpy
2 import six
3 
4 from chainer import reporter
5 from chainer import training
6 from chainer.training import extension
7 
8 
9 class ParameterStatistics(extension.Extension):
10     """Trainer extension to report parameter statistics.
11 
12     Statistics are collected and reported for a given :class:`~chainer.Link`
13     or an iterable of :class:`~chainer.Link`s. If a link contains child links,
14     the statistics are reported separately for each child.
15 
16     Any function that takes a one-dimensional :class:`numpy.ndarray` or a
17     :class:`cupy.ndarray` and outputs a single or multiple real numbers can be
18     registered to handle the collection of statistics, e.g.
19     :meth:`numpy.ndarray.mean`.
20 
21     The keys of reported statistics follow the convention of link name
22     followed by parameter name, attribute name and function name, e.g.
23     ``VGG16Layers/conv1_1/W/data/mean``. They are prepended with an optional
24     prefix and appended with integer indices if the statistics generating
25     function return multiple values.
26 
27     Args:
28         links (~chainer.Link or iterable of ~chainer.Link): Link(s) containing
29             the parameters to observe. The link is expected to have a ``name``
30             attribute which is used as a part of the report key.
31         statistics (dict): Dictionary with function name to function mappings.
32             The name is a string and is used as a part of the report key. The
33             function is responsible for generating the statistics.
34         report_params (bool): If ``True``, report statistics for parameter
35             values such as weights and biases.
36         report_grads (bool): If ``True``, report statistics for parameter
37             gradients.
38         prefix (str): Optional prefix to prepend to the report keys.
39         trigger: Trigger that decides when to aggregate the results and report
40             the values.
41     """
42     default_name = 'parameter_statistics'
43     priority = extension.PRIORITY_WRITER
44 
45     # prefix ends with a '/' and param_name is preceded by a '/'
46     report_key_template = ('{prefix}{link_name}{param_name}/{attr_name}/'
47                            '{function_name}')
48 
49     default_statistics = {
50         'mean': numpy.mean,
51         'std': numpy.std,
52         'min': numpy.min,
53         'max': numpy.max,
54         'zeros': lambda x: numpy.count_nonzero(x == 0),
55         'percentile': lambda x: numpy.percentile(x, (0.13, 2.28, 15.87,
56                                                      50, 84.13, 97.72,
57                                                      99.87))
58     }
59 
60     def __init__(self, links, statistics=default_statistics,
61                  report_params=True, report_grads=True, prefix=None,
62                  trigger=(1, 'epoch')):
63 
64         if not isinstance(links, (list, tuple)):
65             links = links,
66         self._links = links
67 
68         self._statistics = statistics
69 
70         attrs = []
71         if report_params:
72             attrs.append('data')
73         if report_grads:
74             attrs.append('grad')
75         self._attrs = attrs
76 
77         self._prefix = prefix
78         self._trigger = training.trigger.get_trigger(trigger)
79         self._summary = reporter.DictSummary()
80 
81     def __call__(self, trainer):
82         """Execute the statistics extension.
83 
84         Collect statistics for the current state of parameters.
85 
86         Note that this method will merely update its statistic summary, unless
87         the internal trigger is fired. If the trigger is fired, the summary
88         will also be reported and then reset for the next accumulation.
89 
90         Args:
91             trainer (~chainer.training.Trainer): Associated trainer that
92                 invoked this extension.
93         """
94         statistics = {}
95 
96         for link in self._links:
97             link_name = getattr(link, 'name', 'None')
98             for param_name, param in link.namedparams():
99                 for attr_name in self._attrs:
100                     for function_name, function in \
101                             six.iteritems(self._statistics):
102                         # Get parameters as a flattend one-dimensional array
103                         # since the statistics function should make no
104                         # assumption about the axes
105                         params = getattr(param, attr_name).ravel()
106                         value = function(params)
107                         key = self.report_key_template.format(
108                             prefix=self._prefix + '/' if self._prefix else '',
109                             link_name=link_name,
110                             param_name=param_name,
111                             attr_name=attr_name,
112                             function_name=function_name
113                         )
114                         if hasattr(value, '__iter__'):
115                             # Append integer indices to the keys if the
116                             # statistic function return multiple values
117                             statistics.update({'{}/{}'.format(key, i): v for
118                                                i, v in enumerate(value)})
119                         else:
120                             statistics[key] = value
121 
122         self._summary.add(statistics)
123 
124         if self._trigger(trainer):
125             reporter.report(self._summary.compute_mean())
126             self._summary = reporter.DictSummary()  # Clear summary
127 
128     def register_statistics(self, name, function):
129         """Register a function to compute a certain statistic.
130 
131         The registered function will be called each time the extension runs and
132         the results will be included in the report.
133 
134         Args:
135             name (str): Name of the statistic.
136             function: Function to generate the statistic. Any function that
137                 takes a one-dimensional :class:`numpy.ndarray` or a
138                 :class:`cupy.ndarray` and outputs a single or multiple real
139                 numbers is allowed.
140         """
141         self._statistics[name] = function
142
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/chainer/training/__init__.py b/chainer/training/__init__.py
--- a/chainer/training/__init__.py
+++ b/chainer/training/__init__.py
@@ -1,7 +1,11 @@
 from chainer.training import extension  # NOQA
+from chainer.training import extensions  # NOQA
 from chainer.training import trainer  # NOQA
 from chainer.training import trigger  # NOQA
+from chainer.training import triggers  # NOQA
 from chainer.training import updater  # NOQA
+from chainer.training import updaters  # NOQA
+from chainer.training import util  # NOQA
 
 
 # import class and function
diff --git a/chainer/training/extensions/parameter_statistics.py b/chainer/training/extensions/parameter_statistics.py
--- a/chainer/training/extensions/parameter_statistics.py
+++ b/chainer/training/extensions/parameter_statistics.py
@@ -2,8 +2,8 @@
 import six
 
 from chainer import reporter
-from chainer import training
 from chainer.training import extension
+from chainer.training import trigger as trigger_module
 
 
 class ParameterStatistics(extension.Extension):
@@ -75,7 +75,7 @@
         self._attrs = attrs
 
         self._prefix = prefix
-        self._trigger = training.trigger.get_trigger(trigger)
+        self._trigger = trigger_module.get_trigger(trigger)
         self._summary = reporter.DictSummary()
 
     def __call__(self, trainer):

{"golden_diff": "diff --git a/chainer/training/__init__.py b/chainer/training/__init__.py\n--- a/chainer/training/__init__.py\n+++ b/chainer/training/__init__.py\n@@ -1,7 +1,11 @@\n from chainer.training import extension  # NOQA\n+from chainer.training import extensions  # NOQA\n from chainer.training import trainer  # NOQA\n from chainer.training import trigger  # NOQA\n+from chainer.training import triggers  # NOQA\n from chainer.training import updater  # NOQA\n+from chainer.training import updaters  # NOQA\n+from chainer.training import util  # NOQA\n \n \n # import class and function\ndiff --git a/chainer/training/extensions/parameter_statistics.py b/chainer/training/extensions/parameter_statistics.py\n--- a/chainer/training/extensions/parameter_statistics.py\n+++ b/chainer/training/extensions/parameter_statistics.py\n@@ -2,8 +2,8 @@\n import six\n \n from chainer import reporter\n-from chainer import training\n from chainer.training import extension\n+from chainer.training import trigger as trigger_module\n \n \n class ParameterStatistics(extension.Extension):\n@@ -75,7 +75,7 @@\n         self._attrs = attrs\n \n         self._prefix = prefix\n-        self._trigger = training.trigger.get_trigger(trigger)\n+        self._trigger = trigger_module.get_trigger(trigger)\n         self._summary = reporter.DictSummary()\n \n     def __call__(self, trainer):\n", "issue": "inconsistency to use example module\nI found some inconsistent behavior to import classes.\r\n\r\nTo use SOME_CLASS in chainer/iterators, the following code works.\r\n```importIterator.py\r\nimport chainer\r\nsome_class = chainer.iterators.SOME_CLASS() # OK\r\n```\r\nHowever, to use SOME_CLASS in chainer/training/extensions, the following code does not work.\r\n```importExtension.py\r\nimport chainer\r\nsome_class = chainer.training.extensions.SOME_CLASS() #NG\r\n```\r\n\r\nI feel some inconsistency here, because `chainer/__init__.py` contains both of `import iterator` and `import iterators` but `chaner/training/__init__.py` contains only `import extension` and not `import extensions`.\r\n\r\nIs there any reason about this inconsistency?\r\n\r\n* Conditions\r\n  - Chainer version\r\n    chainer v2.0.1\r\n  - OS/Platform\r\n    ubuntu 16.04\r\n* Code to reproduce\r\n```importModule.py\r\nimport chainer\r\niteratorExamples = chainer.iterators # OK\r\n\r\nimport chainer\r\nextensionExamples = chainer.training.extensions #NG\r\n```\r\n\r\n* Error messages\r\n```error.py\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\nAttributeError: module 'chainer.training' has no attribute 'extensions'\r\n```\r\n\r\n\r\n\n", "before_files": [{"content": "from chainer.training import extension  # NOQA\nfrom chainer.training import trainer  # NOQA\nfrom chainer.training import trigger  # NOQA\nfrom chainer.training import updater  # NOQA\n\n\n# import class and function\nfrom chainer.training.extension import Extension  # NOQA\nfrom chainer.training.extension import make_extension  # NOQA\nfrom chainer.training.extension import PRIORITY_EDITOR  # NOQA\nfrom chainer.training.extension import PRIORITY_READER  # NOQA\nfrom chainer.training.extension import PRIORITY_WRITER  # NOQA\nfrom chainer.training.trainer import Trainer  # NOQA\nfrom chainer.training.trigger import get_trigger  # NOQA\nfrom chainer.training.trigger import IntervalTrigger  # NOQA\nfrom chainer.training.updater import ParallelUpdater  # NOQA\nfrom chainer.training.updater import StandardUpdater  # NOQA\nfrom chainer.training.updater import Updater  # NOQA\n", "path": "chainer/training/__init__.py"}, {"content": "import numpy\nimport six\n\nfrom chainer import reporter\nfrom chainer import training\nfrom chainer.training import extension\n\n\nclass ParameterStatistics(extension.Extension):\n    \"\"\"Trainer extension to report parameter statistics.\n\n    Statistics are collected and reported for a given :class:`~chainer.Link`\n    or an iterable of :class:`~chainer.Link`s. If a link contains child links,\n    the statistics are reported separately for each child.\n\n    Any function that takes a one-dimensional :class:`numpy.ndarray` or a\n    :class:`cupy.ndarray` and outputs a single or multiple real numbers can be\n    registered to handle the collection of statistics, e.g.\n    :meth:`numpy.ndarray.mean`.\n\n    The keys of reported statistics follow the convention of link name\n    followed by parameter name, attribute name and function name, e.g.\n    ``VGG16Layers/conv1_1/W/data/mean``. They are prepended with an optional\n    prefix and appended with integer indices if the statistics generating\n    function return multiple values.\n\n    Args:\n        links (~chainer.Link or iterable of ~chainer.Link): Link(s) containing\n            the parameters to observe. The link is expected to have a ``name``\n            attribute which is used as a part of the report key.\n        statistics (dict): Dictionary with function name to function mappings.\n            The name is a string and is used as a part of the report key. The\n            function is responsible for generating the statistics.\n        report_params (bool): If ``True``, report statistics for parameter\n            values such as weights and biases.\n        report_grads (bool): If ``True``, report statistics for parameter\n            gradients.\n        prefix (str): Optional prefix to prepend to the report keys.\n        trigger: Trigger that decides when to aggregate the results and report\n            the values.\n    \"\"\"\n    default_name = 'parameter_statistics'\n    priority = extension.PRIORITY_WRITER\n\n    # prefix ends with a '/' and param_name is preceded by a '/'\n    report_key_template = ('{prefix}{link_name}{param_name}/{attr_name}/'\n                           '{function_name}')\n\n    default_statistics = {\n        'mean': numpy.mean,\n        'std': numpy.std,\n        'min': numpy.min,\n        'max': numpy.max,\n        'zeros': lambda x: numpy.count_nonzero(x == 0),\n        'percentile': lambda x: numpy.percentile(x, (0.13, 2.28, 15.87,\n                                                     50, 84.13, 97.72,\n                                                     99.87))\n    }\n\n    def __init__(self, links, statistics=default_statistics,\n                 report_params=True, report_grads=True, prefix=None,\n                 trigger=(1, 'epoch')):\n\n        if not isinstance(links, (list, tuple)):\n            links = links,\n        self._links = links\n\n        self._statistics = statistics\n\n        attrs = []\n        if report_params:\n            attrs.append('data')\n        if report_grads:\n            attrs.append('grad')\n        self._attrs = attrs\n\n        self._prefix = prefix\n        self._trigger = training.trigger.get_trigger(trigger)\n        self._summary = reporter.DictSummary()\n\n    def __call__(self, trainer):\n        \"\"\"Execute the statistics extension.\n\n        Collect statistics for the current state of parameters.\n\n        Note that this method will merely update its statistic summary, unless\n        the internal trigger is fired. If the trigger is fired, the summary\n        will also be reported and then reset for the next accumulation.\n\n        Args:\n            trainer (~chainer.training.Trainer): Associated trainer that\n                invoked this extension.\n        \"\"\"\n        statistics = {}\n\n        for link in self._links:\n            link_name = getattr(link, 'name', 'None')\n            for param_name, param in link.namedparams():\n                for attr_name in self._attrs:\n                    for function_name, function in \\\n                            six.iteritems(self._statistics):\n                        # Get parameters as a flattend one-dimensional array\n                        # since the statistics function should make no\n                        # assumption about the axes\n                        params = getattr(param, attr_name).ravel()\n                        value = function(params)\n                        key = self.report_key_template.format(\n                            prefix=self._prefix + '/' if self._prefix else '',\n                            link_name=link_name,\n                            param_name=param_name,\n                            attr_name=attr_name,\n                            function_name=function_name\n                        )\n                        if hasattr(value, '__iter__'):\n                            # Append integer indices to the keys if the\n                            # statistic function return multiple values\n                            statistics.update({'{}/{}'.format(key, i): v for\n                                               i, v in enumerate(value)})\n                        else:\n                            statistics[key] = value\n\n        self._summary.add(statistics)\n\n        if self._trigger(trainer):\n            reporter.report(self._summary.compute_mean())\n            self._summary = reporter.DictSummary()  # Clear summary\n\n    def register_statistics(self, name, function):\n        \"\"\"Register a function to compute a certain statistic.\n\n        The registered function will be called each time the extension runs and\n        the results will be included in the report.\n\n        Args:\n            name (str): Name of the statistic.\n            function: Function to generate the statistic. Any function that\n                takes a one-dimensional :class:`numpy.ndarray` or a\n                :class:`cupy.ndarray` and outputs a single or multiple real\n                numbers is allowed.\n        \"\"\"\n        self._statistics[name] = function\n", "path": "chainer/training/extensions/parameter_statistics.py"}], "after_files": [{"content": "from chainer.training import extension  # NOQA\nfrom chainer.training import extensions  # NOQA\nfrom chainer.training import trainer  # NOQA\nfrom chainer.training import trigger  # NOQA\nfrom chainer.training import triggers  # NOQA\nfrom chainer.training import updater  # NOQA\nfrom chainer.training import updaters  # NOQA\nfrom chainer.training import util  # NOQA\n\n\n# import class and function\nfrom chainer.training.extension import Extension  # NOQA\nfrom chainer.training.extension import make_extension  # NOQA\nfrom chainer.training.extension import PRIORITY_EDITOR  # NOQA\nfrom chainer.training.extension import PRIORITY_READER  # NOQA\nfrom chainer.training.extension import PRIORITY_WRITER  # NOQA\nfrom chainer.training.trainer import Trainer  # NOQA\nfrom chainer.training.trigger import get_trigger  # NOQA\nfrom chainer.training.trigger import IntervalTrigger  # NOQA\nfrom chainer.training.updater import ParallelUpdater  # NOQA\nfrom chainer.training.updater import StandardUpdater  # NOQA\nfrom chainer.training.updater import Updater  # NOQA\n", "path": "chainer/training/__init__.py"}, {"content": "import numpy\nimport six\n\nfrom chainer import reporter\nfrom chainer.training import extension\nfrom chainer.training import trigger as trigger_module\n\n\nclass ParameterStatistics(extension.Extension):\n    \"\"\"Trainer extension to report parameter statistics.\n\n    Statistics are collected and reported for a given :class:`~chainer.Link`\n    or an iterable of :class:`~chainer.Link`s. If a link contains child links,\n    the statistics are reported separately for each child.\n\n    Any function that takes a one-dimensional :class:`numpy.ndarray` or a\n    :class:`cupy.ndarray` and outputs a single or multiple real numbers can be\n    registered to handle the collection of statistics, e.g.\n    :meth:`numpy.ndarray.mean`.\n\n    The keys of reported statistics follow the convention of link name\n    followed by parameter name, attribute name and function name, e.g.\n    ``VGG16Layers/conv1_1/W/data/mean``. They are prepended with an optional\n    prefix and appended with integer indices if the statistics generating\n    function return multiple values.\n\n    Args:\n        links (~chainer.Link or iterable of ~chainer.Link): Link(s) containing\n            the parameters to observe. The link is expected to have a ``name``\n            attribute which is used as a part of the report key.\n        statistics (dict): Dictionary with function name to function mappings.\n            The name is a string and is used as a part of the report key. The\n            function is responsible for generating the statistics.\n        report_params (bool): If ``True``, report statistics for parameter\n            values such as weights and biases.\n        report_grads (bool): If ``True``, report statistics for parameter\n            gradients.\n        prefix (str): Optional prefix to prepend to the report keys.\n        trigger: Trigger that decides when to aggregate the results and report\n            the values.\n    \"\"\"\n    default_name = 'parameter_statistics'\n    priority = extension.PRIORITY_WRITER\n\n    # prefix ends with a '/' and param_name is preceded by a '/'\n    report_key_template = ('{prefix}{link_name}{param_name}/{attr_name}/'\n                           '{function_name}')\n\n    default_statistics = {\n        'mean': numpy.mean,\n        'std': numpy.std,\n        'min': numpy.min,\n        'max': numpy.max,\n        'zeros': lambda x: numpy.count_nonzero(x == 0),\n        'percentile': lambda x: numpy.percentile(x, (0.13, 2.28, 15.87,\n                                                     50, 84.13, 97.72,\n                                                     99.87))\n    }\n\n    def __init__(self, links, statistics=default_statistics,\n                 report_params=True, report_grads=True, prefix=None,\n                 trigger=(1, 'epoch')):\n\n        if not isinstance(links, (list, tuple)):\n            links = links,\n        self._links = links\n\n        self._statistics = statistics\n\n        attrs = []\n        if report_params:\n            attrs.append('data')\n        if report_grads:\n            attrs.append('grad')\n        self._attrs = attrs\n\n        self._prefix = prefix\n        self._trigger = trigger_module.get_trigger(trigger)\n        self._summary = reporter.DictSummary()\n\n    def __call__(self, trainer):\n        \"\"\"Execute the statistics extension.\n\n        Collect statistics for the current state of parameters.\n\n        Note that this method will merely update its statistic summary, unless\n        the internal trigger is fired. If the trigger is fired, the summary\n        will also be reported and then reset for the next accumulation.\n\n        Args:\n            trainer (~chainer.training.Trainer): Associated trainer that\n                invoked this extension.\n        \"\"\"\n        statistics = {}\n\n        for link in self._links:\n            link_name = getattr(link, 'name', 'None')\n            for param_name, param in link.namedparams():\n                for attr_name in self._attrs:\n                    for function_name, function in \\\n                            six.iteritems(self._statistics):\n                        # Get parameters as a flattend one-dimensional array\n                        # since the statistics function should make no\n                        # assumption about the axes\n                        params = getattr(param, attr_name).ravel()\n                        value = function(params)\n                        key = self.report_key_template.format(\n                            prefix=self._prefix + '/' if self._prefix else '',\n                            link_name=link_name,\n                            param_name=param_name,\n                            attr_name=attr_name,\n                            function_name=function_name\n                        )\n                        if hasattr(value, '__iter__'):\n                            # Append integer indices to the keys if the\n                            # statistic function return multiple values\n                            statistics.update({'{}/{}'.format(key, i): v for\n                                               i, v in enumerate(value)})\n                        else:\n                            statistics[key] = value\n\n        self._summary.add(statistics)\n\n        if self._trigger(trainer):\n            reporter.report(self._summary.compute_mean())\n            self._summary = reporter.DictSummary()  # Clear summary\n\n    def register_statistics(self, name, function):\n        \"\"\"Register a function to compute a certain statistic.\n\n        The registered function will be called each time the extension runs and\n        the results will be included in the report.\n\n        Args:\n            name (str): Name of the statistic.\n            function: Function to generate the statistic. Any function that\n                takes a one-dimensional :class:`numpy.ndarray` or a\n                :class:`cupy.ndarray` and outputs a single or multiple real\n                numbers is allowed.\n        \"\"\"\n        self._statistics[name] = function\n", "path": "chainer/training/extensions/parameter_statistics.py"}]}