prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Generate API docs
  As our repository matures it's important to have api docs to improve user experience. As discussed in #38 we will also be able to remove the table of contents off the main README.
  
  Should we host on https://readthedocs.org/ or is there something else recommended @ewilderj @dynamicwebpaige @karmel ?
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `tools/docs/build_docs.py`
  Content:
  ```
  1 # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 # ==============================================================================
  15 """ Modified from the tfdocs example api reference docs generation script.
  16 
  17 This script generates API reference docs.
  18 
  19 Install pre-requisites:
  20 $> pip install -U git+https://github.com/tensorflow/docs
  21 $> pip install artifacts/tensorflow_addons-*.whl
  22 
  23 Generate Docs:
  24 $> from the repo root run: python tools/docs/build_docs.py
  25 """
  26 
  27 from __future__ import absolute_import
  28 from __future__ import division
  29 from __future__ import print_function
  30 
  31 from absl import app
  32 from absl import flags
  33 
  34 import tensorflow_addons
  35 from tensorflow_docs.api_generator import generate_lib
  36 from tensorflow_docs.api_generator import public_api
  37 
  38 PROJECT_SHORT_NAME = 'tfaddons'
  39 PROJECT_FULL_NAME = 'TensorFlow Addons'
  40 CODE_URL_PREFIX = 'https://github.com/tensorflow/addons/tree/master/tensorflow_addons'
  41 
  42 FLAGS = flags.FLAGS
  43 
  44 flags.DEFINE_string(
  45     'output_dir',
  46     default='/addons/docs/api_docs/python/',
  47     help='Where to write the resulting docs to.')
  48 
  49 
  50 def main(argv):
  51     if argv[1:]:
  52         raise ValueError('Unrecognized arguments: {}'.format(argv[1:]))
  53 
  54     doc_generator = generate_lib.DocGenerator(
  55         root_title=PROJECT_FULL_NAME,
  56         # Replace `tensorflow_docs` with your module, here.
  57         py_modules=[(PROJECT_SHORT_NAME, tensorflow_addons)],
  58         code_url_prefix=CODE_URL_PREFIX,
  59         # This callback cleans up a lot of aliases caused by internal imports.
  60         callbacks=[public_api.local_definitions_filter])
  61 
  62     doc_generator.build(FLAGS.output_dir)
  63 
  64     print('Output docs to: ', FLAGS.output_dir)
  65 
  66 
  67 if __name__ == '__main__':
  68     app.run(main)
  69
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/tools/docs/build_docs.py b/tools/docs/build_docs.py
  --- a/tools/docs/build_docs.py
  +++ b/tools/docs/build_docs.py
  @@ -12,7 +12,7 @@
   # See the License for the specific language governing permissions and
   # limitations under the License.
   # ==============================================================================
  -""" Modified from the tfdocs example api reference docs generation script.
  +"""Modified from the tfdocs example api reference docs generation script.
   
   This script generates API reference docs.
   
  @@ -31,19 +31,30 @@
   from absl import app
   from absl import flags
   
  -import tensorflow_addons
  +import tensorflow_addons as tfa
  +
   from tensorflow_docs.api_generator import generate_lib
  +from tensorflow_docs.api_generator import parser
   from tensorflow_docs.api_generator import public_api
   
  -PROJECT_SHORT_NAME = 'tfaddons'
  +from tensorflow.python.util import tf_inspect
  +
  +# Use tensorflow's `tf_inspect`, which is aware of `tf_decorator`.
  +parser.tf_inspect = tf_inspect
  +
  +PROJECT_SHORT_NAME = 'tfa'
   PROJECT_FULL_NAME = 'TensorFlow Addons'
  -CODE_URL_PREFIX = 'https://github.com/tensorflow/addons/tree/master/tensorflow_addons'
   
   FLAGS = flags.FLAGS
   
  +flags.DEFINE_string(
  +    'git_branch',
  +    default='master',
  +    help='The name of the corresponding branch on github.')
  +
   flags.DEFINE_string(
       'output_dir',
  -    default='/addons/docs/api_docs/python/',
  +    default='docs/api_docs/python/',
       help='Where to write the resulting docs to.')
   
   
  @@ -51,11 +62,16 @@
       if argv[1:]:
           raise ValueError('Unrecognized arguments: {}'.format(argv[1:]))
   
  +    code_url_prefix = ('https://github.com/tensorflow/addons/tree/'
  +                       '{git_branch}/tensorflow_addons'.format(
  +                           git_branch=FLAGS.git_branch))
  +
       doc_generator = generate_lib.DocGenerator(
           root_title=PROJECT_FULL_NAME,
           # Replace `tensorflow_docs` with your module, here.
  -        py_modules=[(PROJECT_SHORT_NAME, tensorflow_addons)],
  -        code_url_prefix=CODE_URL_PREFIX,
  +        py_modules=[(PROJECT_SHORT_NAME, tfa)],
  +        code_url_prefix=code_url_prefix,
  +        private_map={'tfa': ['__version__', 'utils', 'version']},
           # This callback cleans up a lot of aliases caused by internal imports.
           callbacks=[public_api.local_definitions_filter])
  
verification_info: {"golden_diff": "diff --git a/tools/docs/build_docs.py b/tools/docs/build_docs.py\n--- a/tools/docs/build_docs.py\n+++ b/tools/docs/build_docs.py\n@@ -12,7 +12,7 @@\n # See the License for the specific language governing permissions and\n # limitations under the License.\n # ==============================================================================\n-\"\"\" Modified from the tfdocs example api reference docs generation script.\n+\"\"\"Modified from the tfdocs example api reference docs generation script.\n \n This script generates API reference docs.\n \n@@ -31,19 +31,30 @@\n from absl import app\n from absl import flags\n \n-import tensorflow_addons\n+import tensorflow_addons as tfa\n+\n from tensorflow_docs.api_generator import generate_lib\n+from tensorflow_docs.api_generator import parser\n from tensorflow_docs.api_generator import public_api\n \n-PROJECT_SHORT_NAME = 'tfaddons'\n+from tensorflow.python.util import tf_inspect\n+\n+# Use tensorflow's `tf_inspect`, which is aware of `tf_decorator`.\n+parser.tf_inspect = tf_inspect\n+\n+PROJECT_SHORT_NAME = 'tfa'\n PROJECT_FULL_NAME = 'TensorFlow Addons'\n-CODE_URL_PREFIX = 'https://github.com/tensorflow/addons/tree/master/tensorflow_addons'\n \n FLAGS = flags.FLAGS\n \n+flags.DEFINE_string(\n+    'git_branch',\n+    default='master',\n+    help='The name of the corresponding branch on github.')\n+\n flags.DEFINE_string(\n     'output_dir',\n-    default='/addons/docs/api_docs/python/',\n+    default='docs/api_docs/python/',\n     help='Where to write the resulting docs to.')\n \n \n@@ -51,11 +62,16 @@\n     if argv[1:]:\n         raise ValueError('Unrecognized arguments: {}'.format(argv[1:]))\n \n+    code_url_prefix = ('https://github.com/tensorflow/addons/tree/'\n+                       '{git_branch}/tensorflow_addons'.format(\n+                           git_branch=FLAGS.git_branch))\n+\n     doc_generator = generate_lib.DocGenerator(\n         root_title=PROJECT_FULL_NAME,\n         # Replace `tensorflow_docs` with your module, here.\n-        py_modules=[(PROJECT_SHORT_NAME, tensorflow_addons)],\n-        code_url_prefix=CODE_URL_PREFIX,\n+        py_modules=[(PROJECT_SHORT_NAME, tfa)],\n+        code_url_prefix=code_url_prefix,\n+        private_map={'tfa': ['__version__', 'utils', 'version']},\n         # This callback cleans up a lot of aliases caused by internal imports.\n         callbacks=[public_api.local_definitions_filter])\n", "issue": "Generate API docs\nAs our repository matures it's important to have api docs to improve user experience. As discussed in #38 we will also be able to remove the table of contents off the main README.\r\n\r\nShould we host on https://readthedocs.org/ or is there something else recommended @ewilderj @dynamicwebpaige @karmel ?\n", "before_files": [{"content": "# Copyright 2015 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ==============================================================================\n\"\"\" Modified from the tfdocs example api reference docs generation script.\n\nThis script generates API reference docs.\n\nInstall pre-requisites:\n$> pip install -U git+https://github.com/tensorflow/docs\n$> pip install artifacts/tensorflow_addons-*.whl\n\nGenerate Docs:\n$> from the repo root run: python tools/docs/build_docs.py\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom absl import app\nfrom absl import flags\n\nimport tensorflow_addons\nfrom tensorflow_docs.api_generator import generate_lib\nfrom tensorflow_docs.api_generator import public_api\n\nPROJECT_SHORT_NAME = 'tfaddons'\nPROJECT_FULL_NAME = 'TensorFlow Addons'\nCODE_URL_PREFIX = 'https://github.com/tensorflow/addons/tree/master/tensorflow_addons'\n\nFLAGS = flags.FLAGS\n\nflags.DEFINE_string(\n    'output_dir',\n    default='/addons/docs/api_docs/python/',\n    help='Where to write the resulting docs to.')\n\n\ndef main(argv):\n    if argv[1:]:\n        raise ValueError('Unrecognized arguments: {}'.format(argv[1:]))\n\n    doc_generator = generate_lib.DocGenerator(\n        root_title=PROJECT_FULL_NAME,\n        # Replace `tensorflow_docs` with your module, here.\n        py_modules=[(PROJECT_SHORT_NAME, tensorflow_addons)],\n        code_url_prefix=CODE_URL_PREFIX,\n        # This callback cleans up a lot of aliases caused by internal imports.\n        callbacks=[public_api.local_definitions_filter])\n\n    doc_generator.build(FLAGS.output_dir)\n\n    print('Output docs to: ', FLAGS.output_dir)\n\n\nif __name__ == '__main__':\n    app.run(main)\n", "path": "tools/docs/build_docs.py"}], "after_files": [{"content": "# Copyright 2015 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ==============================================================================\n\"\"\"Modified from the tfdocs example api reference docs generation script.\n\nThis script generates API reference docs.\n\nInstall pre-requisites:\n$> pip install -U git+https://github.com/tensorflow/docs\n$> pip install artifacts/tensorflow_addons-*.whl\n\nGenerate Docs:\n$> from the repo root run: python tools/docs/build_docs.py\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom absl import app\nfrom absl import flags\n\nimport tensorflow_addons as tfa\n\nfrom tensorflow_docs.api_generator import generate_lib\nfrom tensorflow_docs.api_generator import parser\nfrom tensorflow_docs.api_generator import public_api\n\nfrom tensorflow.python.util import tf_inspect\n\n# Use tensorflow's `tf_inspect`, which is aware of `tf_decorator`.\nparser.tf_inspect = tf_inspect\n\nPROJECT_SHORT_NAME = 'tfa'\nPROJECT_FULL_NAME = 'TensorFlow Addons'\n\nFLAGS = flags.FLAGS\n\nflags.DEFINE_string(\n    'git_branch',\n    default='master',\n    help='The name of the corresponding branch on github.')\n\nflags.DEFINE_string(\n    'output_dir',\n    default='docs/api_docs/python/',\n    help='Where to write the resulting docs to.')\n\n\ndef main(argv):\n    if argv[1:]:\n        raise ValueError('Unrecognized arguments: {}'.format(argv[1:]))\n\n    code_url_prefix = ('https://github.com/tensorflow/addons/tree/'\n                       '{git_branch}/tensorflow_addons'.format(\n                           git_branch=FLAGS.git_branch))\n\n    doc_generator = generate_lib.DocGenerator(\n        root_title=PROJECT_FULL_NAME,\n        # Replace `tensorflow_docs` with your module, here.\n        py_modules=[(PROJECT_SHORT_NAME, tfa)],\n        code_url_prefix=code_url_prefix,\n        private_map={'tfa': ['__version__', 'utils', 'version']},\n        # This callback cleans up a lot of aliases caused by internal imports.\n        callbacks=[public_api.local_definitions_filter])\n\n    doc_generator.build(FLAGS.output_dir)\n\n    print('Output docs to: ', FLAGS.output_dir)\n\n\nif __name__ == '__main__':\n    app.run(main)\n", "path": "tools/docs/build_docs.py"}]}