We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Extra dot in 0.12 docs
Looks like something similar to the previous release happened https://github.com/pytorch/vision/issues/4754

The newly pushed docs are https://pytorch.org/vision/0.12./ instead of https://pytorch.org/vision/0.12 (extra dot at the end), and the version tag shows a lot of extra info:

![image](https://user-images.githubusercontent.com/1190450/157628238-5e10b9ce-3e7f-4364-8822-ac838023bbab.png)


@mattip  is this something you could help us with, like you did in https://github.com/pytorch/vision/pull/4755 ?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docs/source/conf.py`
Content:
```
1 #!/usr/bin/env python3
2 #
3 # PyTorch documentation build configuration file, created by
4 # sphinx-quickstart on Fri Dec 23 13:31:47 2016.
5 #
6 # This file is execfile()d with the current directory set to its
7 # containing dir.
8 #
9 # Note that not all possible configuration values are present in this
10 # autogenerated file.
11 #
12 # All configuration values have a default; values that are commented out
13 # serve to show the default.
14 
15 # If extensions (or modules to document with autodoc) are in another directory,
16 # add these directories to sys.path here. If the directory is relative to the
17 # documentation root, use os.path.abspath to make it absolute, like shown here.
18 #
19 # import os
20 # import sys
21 # sys.path.insert(0, os.path.abspath('.'))
22 
23 import pytorch_sphinx_theme
24 import torchvision
25 
26 
27 # -- General configuration ------------------------------------------------
28 
29 # Required version of sphinx is set from docs/requirements.txt
30 
31 # Add any Sphinx extension module names here, as strings. They can be
32 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33 # ones.
34 extensions = [
35     "sphinx.ext.autodoc",
36     "sphinx.ext.autosummary",
37     "sphinx.ext.doctest",
38     "sphinx.ext.intersphinx",
39     "sphinx.ext.todo",
40     "sphinx.ext.mathjax",
41     "sphinx.ext.napoleon",
42     "sphinx.ext.viewcode",
43     "sphinx.ext.duration",
44     "sphinx_gallery.gen_gallery",
45     "sphinx_copybutton",
46 ]
47 
48 sphinx_gallery_conf = {
49     "examples_dirs": "../../gallery/",  # path to your example scripts
50     "gallery_dirs": "auto_examples",  # path to where to save gallery generated output
51     "backreferences_dir": "gen_modules/backreferences",
52     "doc_module": ("torchvision",),
53 }
54 
55 napoleon_use_ivar = True
56 napoleon_numpy_docstring = False
57 napoleon_google_docstring = True
58 
59 
60 # Add any paths that contain templates here, relative to this directory.
61 templates_path = ["_templates"]
62 
63 # The suffix(es) of source filenames.
64 # You can specify multiple suffix as a list of string:
65 #
66 source_suffix = {
67     ".rst": "restructuredtext",
68 }
69 
70 # The master toctree document.
71 master_doc = "index"
72 
73 # General information about the project.
74 project = "Torchvision"
75 copyright = "2017-present, Torch Contributors"
76 author = "Torch Contributors"
77 
78 # The version info for the project you're documenting, acts as replacement for
79 # |version| and |release|, also used in various other places throughout the
80 # built documents.
81 #
82 # The short X.Y version.
83 # TODO: change to [:2] at v1.0
84 version = "main (" + torchvision.__version__ + " )"
85 # The full version, including alpha/beta/rc tags.
86 # TODO: verify this works as expected
87 release = "main"
88 
89 # The language for content autogenerated by Sphinx. Refer to documentation
90 # for a list of supported languages.
91 #
92 # This is also used if you do content translation via gettext catalogs.
93 # Usually you set "language" from the command line for these cases.
94 language = None
95 
96 # List of patterns, relative to source directory, that match files and
97 # directories to ignore when looking for source files.
98 # This patterns also effect to html_static_path and html_extra_path
99 exclude_patterns = []
100 
101 # The name of the Pygments (syntax highlighting) style to use.
102 pygments_style = "sphinx"
103 
104 # If true, `todo` and `todoList` produce output, else they produce nothing.
105 todo_include_todos = True
106 
107 
108 # -- Options for HTML output ----------------------------------------------
109 
110 # The theme to use for HTML and HTML Help pages.  See the documentation for
111 # a list of builtin themes.
112 #
113 html_theme = "pytorch_sphinx_theme"
114 html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
115 
116 # Theme options are theme-specific and customize the look and feel of a theme
117 # further.  For a list of options available for each theme, see the
118 # documentation.
119 #
120 html_theme_options = {
121     "collapse_navigation": False,
122     "display_version": True,
123     "logo_only": True,
124     "pytorch_project": "docs",
125     "navigation_with_keys": True,
126     "analytics_id": "UA-117752657-2",
127 }
128 
129 html_logo = "_static/img/pytorch-logo-dark.svg"
130 
131 # Add any paths that contain custom static files (such as style sheets) here,
132 # relative to this directory. They are copied after the builtin static files,
133 # so a file named "default.css" will overwrite the builtin "default.css".
134 html_static_path = ["_static"]
135 
136 # TODO: remove this once https://github.com/pytorch/pytorch_sphinx_theme/issues/125 is fixed
137 html_css_files = [
138     "css/custom_torchvision.css",
139 ]
140 
141 # -- Options for HTMLHelp output ------------------------------------------
142 
143 # Output file base name for HTML help builder.
144 htmlhelp_basename = "PyTorchdoc"
145 
146 
147 autosummary_generate = True
148 
149 
150 # -- Options for LaTeX output ---------------------------------------------
151 latex_elements = {
152     # The paper size ('letterpaper' or 'a4paper').
153     #
154     # 'papersize': 'letterpaper',
155     # The font size ('10pt', '11pt' or '12pt').
156     #
157     # 'pointsize': '10pt',
158     # Additional stuff for the LaTeX preamble.
159     #
160     # 'preamble': '',
161     # Latex figure (float) alignment
162     #
163     # 'figure_align': 'htbp',
164 }
165 
166 
167 # Grouping the document tree into LaTeX files. List of tuples
168 # (source start file, target name, title,
169 #  author, documentclass [howto, manual, or own class]).
170 latex_documents = [
171     (master_doc, "pytorch.tex", "torchvision Documentation", "Torch Contributors", "manual"),
172 ]
173 
174 
175 # -- Options for manual page output ---------------------------------------
176 
177 # One entry per manual page. List of tuples
178 # (source start file, name, description, authors, manual section).
179 man_pages = [(master_doc, "torchvision", "torchvision Documentation", [author], 1)]
180 
181 
182 # -- Options for Texinfo output -------------------------------------------
183 
184 # Grouping the document tree into Texinfo files. List of tuples
185 # (source start file, target name, title, author,
186 #  dir menu entry, description, category)
187 texinfo_documents = [
188     (
189         master_doc,
190         "torchvision",
191         "torchvision Documentation",
192         author,
193         "torchvision",
194         "One line description of project.",
195         "Miscellaneous",
196     ),
197 ]
198 
199 
200 # Example configuration for intersphinx: refer to the Python standard library.
201 intersphinx_mapping = {
202     "python": ("https://docs.python.org/3/", None),
203     "torch": ("https://pytorch.org/docs/stable/", None),
204     "numpy": ("https://numpy.org/doc/stable/", None),
205     "PIL": ("https://pillow.readthedocs.io/en/stable/", None),
206     "matplotlib": ("https://matplotlib.org/stable/", None),
207 }
208 
209 # -- A patch that prevents Sphinx from cross-referencing ivar tags -------
210 # See http://stackoverflow.com/a/41184353/3343043
211 
212 from docutils import nodes
213 from sphinx import addnodes
214 from sphinx.util.docfields import TypedField
215 
216 
217 def patched_make_field(self, types, domain, items, **kw):
218     # `kw` catches `env=None` needed for newer sphinx while maintaining
219     #  backwards compatibility when passed along further down!
220 
221     # type: (list, unicode, tuple) -> nodes.field  # noqa: F821
222     def handle_item(fieldarg, content):
223         par = nodes.paragraph()
224         par += addnodes.literal_strong("", fieldarg)  # Patch: this line added
225         # par.extend(self.make_xrefs(self.rolename, domain, fieldarg,
226         #                           addnodes.literal_strong))
227         if fieldarg in types:
228             par += nodes.Text(" (")
229             # NOTE: using .pop() here to prevent a single type node to be
230             # inserted twice into the doctree, which leads to
231             # inconsistencies later when references are resolved
232             fieldtype = types.pop(fieldarg)
233             if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):
234                 typename = "".join(n.astext() for n in fieldtype)
235                 typename = typename.replace("int", "python:int")
236                 typename = typename.replace("long", "python:long")
237                 typename = typename.replace("float", "python:float")
238                 typename = typename.replace("type", "python:type")
239                 par.extend(self.make_xrefs(self.typerolename, domain, typename, addnodes.literal_emphasis, **kw))
240             else:
241                 par += fieldtype
242             par += nodes.Text(")")
243         par += nodes.Text(" -- ")
244         par += content
245         return par
246 
247     fieldname = nodes.field_name("", self.label)
248     if len(items) == 1 and self.can_collapse:
249         fieldarg, content = items[0]
250         bodynode = handle_item(fieldarg, content)
251     else:
252         bodynode = self.list_type()
253         for fieldarg, content in items:
254             bodynode += nodes.list_item("", handle_item(fieldarg, content))
255     fieldbody = nodes.field_body("", bodynode)
256     return nodes.field("", fieldname, fieldbody)
257 
258 
259 TypedField.make_field = patched_make_field
260 
261 
262 def inject_minigalleries(app, what, name, obj, options, lines):
263     """Inject a minigallery into a docstring.
264 
265     This avoids having to manually write the .. minigallery directive for every item we want a minigallery for,
266     as it would be easy to miss some.
267 
268     This callback is called after the .. auto directives (like ..autoclass) have been processed,
269     and modifies the lines parameter inplace to add the .. minigallery that will show which examples
270     are using which object.
271 
272     It's a bit hacky, but not *that* hacky when you consider that the recommended way is to do pretty much the same,
273     but instead with templates using autosummary (which we don't want to use):
274     (https://sphinx-gallery.github.io/stable/configuration.html#auto-documenting-your-api-with-links-to-examples)
275 
276     For docs on autodoc-process-docstring, see the autodoc docs:
277     https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
278     """
279 
280     if what in ("class", "function"):
281         lines.append(f".. minigallery:: {name}")
282         lines.append(f"    :add-heading: Examples using ``{name.split('.')[-1]}``:")
283         # avoid heading entirely to avoid warning. As a bonud it actually renders better
284         lines.append("    :heading-level: 9")
285         lines.append("\n")
286 
287 
288 def setup(app):
289     app.connect("autodoc-process-docstring", inject_minigalleries)
290
```
--- 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/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -20,6 +20,8 @@
 # import sys
 # sys.path.insert(0, os.path.abspath('.'))
 
+import os
+
 import pytorch_sphinx_theme
 import torchvision
 
@@ -80,11 +82,16 @@
 # built documents.
 #
 # The short X.Y version.
-# TODO: change to [:2] at v1.0
 version = "main (" + torchvision.__version__ + " )"
 # The full version, including alpha/beta/rc tags.
-# TODO: verify this works as expected
 release = "main"
+VERSION = os.environ.get("VERSION", None)
+if VERSION:
+    # Turn 1.11.0aHASH into 1.11 (major.minor only)
+    version = ".".join(version.split(".")[:2])
+    html_title = " ".join((project, version, "documentation"))
+    release = version
+
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

{"golden_diff": "diff --git a/docs/source/conf.py b/docs/source/conf.py\n--- a/docs/source/conf.py\n+++ b/docs/source/conf.py\n@@ -20,6 +20,8 @@\n # import sys\n # sys.path.insert(0, os.path.abspath('.'))\n \n+import os\n+\n import pytorch_sphinx_theme\n import torchvision\n \n@@ -80,11 +82,16 @@\n # built documents.\n #\n # The short X.Y version.\n-# TODO: change to [:2] at v1.0\n version = \"main (\" + torchvision.__version__ + \" )\"\n # The full version, including alpha/beta/rc tags.\n-# TODO: verify this works as expected\n release = \"main\"\n+VERSION = os.environ.get(\"VERSION\", None)\n+if VERSION:\n+    # Turn 1.11.0aHASH into 1.11 (major.minor only)\n+    version = \".\".join(version.split(\".\")[:2])\n+    html_title = \" \".join((project, version, \"documentation\"))\n+    release = version\n+\n \n # The language for content autogenerated by Sphinx. Refer to documentation\n # for a list of supported languages.\n", "issue": "Extra dot in 0.12 docs\nLooks like something similar to the previous release happened https://github.com/pytorch/vision/issues/4754\r\n\r\nThe newly pushed docs are https://pytorch.org/vision/0.12./ instead of https://pytorch.org/vision/0.12 (extra dot at the end), and the version tag shows a lot of extra info:\r\n\r\n![image](https://user-images.githubusercontent.com/1190450/157628238-5e10b9ce-3e7f-4364-8822-ac838023bbab.png)\r\n\r\n\r\n@mattip  is this something you could help us with, like you did in https://github.com/pytorch/vision/pull/4755 ?\n", "before_files": [{"content": "#!/usr/bin/env python3\n#\n# PyTorch documentation build configuration file, created by\n# sphinx-quickstart on Fri Dec 23 13:31:47 2016.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\n# import os\n# import sys\n# sys.path.insert(0, os.path.abspath('.'))\n\nimport pytorch_sphinx_theme\nimport torchvision\n\n\n# -- General configuration ------------------------------------------------\n\n# Required version of sphinx is set from docs/requirements.txt\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n    \"sphinx.ext.autodoc\",\n    \"sphinx.ext.autosummary\",\n    \"sphinx.ext.doctest\",\n    \"sphinx.ext.intersphinx\",\n    \"sphinx.ext.todo\",\n    \"sphinx.ext.mathjax\",\n    \"sphinx.ext.napoleon\",\n    \"sphinx.ext.viewcode\",\n    \"sphinx.ext.duration\",\n    \"sphinx_gallery.gen_gallery\",\n    \"sphinx_copybutton\",\n]\n\nsphinx_gallery_conf = {\n    \"examples_dirs\": \"../../gallery/\",  # path to your example scripts\n    \"gallery_dirs\": \"auto_examples\",  # path to where to save gallery generated output\n    \"backreferences_dir\": \"gen_modules/backreferences\",\n    \"doc_module\": (\"torchvision\",),\n}\n\nnapoleon_use_ivar = True\nnapoleon_numpy_docstring = False\nnapoleon_google_docstring = True\n\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = [\"_templates\"]\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\nsource_suffix = {\n    \".rst\": \"restructuredtext\",\n}\n\n# The master toctree document.\nmaster_doc = \"index\"\n\n# General information about the project.\nproject = \"Torchvision\"\ncopyright = \"2017-present, Torch Contributors\"\nauthor = \"Torch Contributors\"\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\n# TODO: change to [:2] at v1.0\nversion = \"main (\" + torchvision.__version__ + \" )\"\n# The full version, including alpha/beta/rc tags.\n# TODO: verify this works as expected\nrelease = \"main\"\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This patterns also effect to html_static_path and html_extra_path\nexclude_patterns = []\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = \"sphinx\"\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = True\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes.\n#\nhtml_theme = \"pytorch_sphinx_theme\"\nhtml_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further.  For a list of options available for each theme, see the\n# documentation.\n#\nhtml_theme_options = {\n    \"collapse_navigation\": False,\n    \"display_version\": True,\n    \"logo_only\": True,\n    \"pytorch_project\": \"docs\",\n    \"navigation_with_keys\": True,\n    \"analytics_id\": \"UA-117752657-2\",\n}\n\nhtml_logo = \"_static/img/pytorch-logo-dark.svg\"\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = [\"_static\"]\n\n# TODO: remove this once https://github.com/pytorch/pytorch_sphinx_theme/issues/125 is fixed\nhtml_css_files = [\n    \"css/custom_torchvision.css\",\n]\n\n# -- Options for HTMLHelp output ------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = \"PyTorchdoc\"\n\n\nautosummary_generate = True\n\n\n# -- Options for LaTeX output ---------------------------------------------\nlatex_elements = {\n    # The paper size ('letterpaper' or 'a4paper').\n    #\n    # 'papersize': 'letterpaper',\n    # The font size ('10pt', '11pt' or '12pt').\n    #\n    # 'pointsize': '10pt',\n    # Additional stuff for the LaTeX preamble.\n    #\n    # 'preamble': '',\n    # Latex figure (float) alignment\n    #\n    # 'figure_align': 'htbp',\n}\n\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n#  author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n    (master_doc, \"pytorch.tex\", \"torchvision Documentation\", \"Torch Contributors\", \"manual\"),\n]\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [(master_doc, \"torchvision\", \"torchvision Documentation\", [author], 1)]\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n#  dir menu entry, description, category)\ntexinfo_documents = [\n    (\n        master_doc,\n        \"torchvision\",\n        \"torchvision Documentation\",\n        author,\n        \"torchvision\",\n        \"One line description of project.\",\n        \"Miscellaneous\",\n    ),\n]\n\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3/\", None),\n    \"torch\": (\"https://pytorch.org/docs/stable/\", None),\n    \"numpy\": (\"https://numpy.org/doc/stable/\", None),\n    \"PIL\": (\"https://pillow.readthedocs.io/en/stable/\", None),\n    \"matplotlib\": (\"https://matplotlib.org/stable/\", None),\n}\n\n# -- A patch that prevents Sphinx from cross-referencing ivar tags -------\n# See http://stackoverflow.com/a/41184353/3343043\n\nfrom docutils import nodes\nfrom sphinx import addnodes\nfrom sphinx.util.docfields import TypedField\n\n\ndef patched_make_field(self, types, domain, items, **kw):\n    # `kw` catches `env=None` needed for newer sphinx while maintaining\n    #  backwards compatibility when passed along further down!\n\n    # type: (list, unicode, tuple) -> nodes.field  # noqa: F821\n    def handle_item(fieldarg, content):\n        par = nodes.paragraph()\n        par += addnodes.literal_strong(\"\", fieldarg)  # Patch: this line added\n        # par.extend(self.make_xrefs(self.rolename, domain, fieldarg,\n        #                           addnodes.literal_strong))\n        if fieldarg in types:\n            par += nodes.Text(\" (\")\n            # NOTE: using .pop() here to prevent a single type node to be\n            # inserted twice into the doctree, which leads to\n            # inconsistencies later when references are resolved\n            fieldtype = types.pop(fieldarg)\n            if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):\n                typename = \"\".join(n.astext() for n in fieldtype)\n                typename = typename.replace(\"int\", \"python:int\")\n                typename = typename.replace(\"long\", \"python:long\")\n                typename = typename.replace(\"float\", \"python:float\")\n                typename = typename.replace(\"type\", \"python:type\")\n                par.extend(self.make_xrefs(self.typerolename, domain, typename, addnodes.literal_emphasis, **kw))\n            else:\n                par += fieldtype\n            par += nodes.Text(\")\")\n        par += nodes.Text(\" -- \")\n        par += content\n        return par\n\n    fieldname = nodes.field_name(\"\", self.label)\n    if len(items) == 1 and self.can_collapse:\n        fieldarg, content = items[0]\n        bodynode = handle_item(fieldarg, content)\n    else:\n        bodynode = self.list_type()\n        for fieldarg, content in items:\n            bodynode += nodes.list_item(\"\", handle_item(fieldarg, content))\n    fieldbody = nodes.field_body(\"\", bodynode)\n    return nodes.field(\"\", fieldname, fieldbody)\n\n\nTypedField.make_field = patched_make_field\n\n\ndef inject_minigalleries(app, what, name, obj, options, lines):\n    \"\"\"Inject a minigallery into a docstring.\n\n    This avoids having to manually write the .. minigallery directive for every item we want a minigallery for,\n    as it would be easy to miss some.\n\n    This callback is called after the .. auto directives (like ..autoclass) have been processed,\n    and modifies the lines parameter inplace to add the .. minigallery that will show which examples\n    are using which object.\n\n    It's a bit hacky, but not *that* hacky when you consider that the recommended way is to do pretty much the same,\n    but instead with templates using autosummary (which we don't want to use):\n    (https://sphinx-gallery.github.io/stable/configuration.html#auto-documenting-your-api-with-links-to-examples)\n\n    For docs on autodoc-process-docstring, see the autodoc docs:\n    https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html\n    \"\"\"\n\n    if what in (\"class\", \"function\"):\n        lines.append(f\".. minigallery:: {name}\")\n        lines.append(f\"    :add-heading: Examples using ``{name.split('.')[-1]}``:\")\n        # avoid heading entirely to avoid warning. As a bonud it actually renders better\n        lines.append(\"    :heading-level: 9\")\n        lines.append(\"\\n\")\n\n\ndef setup(app):\n    app.connect(\"autodoc-process-docstring\", inject_minigalleries)\n", "path": "docs/source/conf.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n#\n# PyTorch documentation build configuration file, created by\n# sphinx-quickstart on Fri Dec 23 13:31:47 2016.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\n# import os\n# import sys\n# sys.path.insert(0, os.path.abspath('.'))\n\nimport os\n\nimport pytorch_sphinx_theme\nimport torchvision\n\n\n# -- General configuration ------------------------------------------------\n\n# Required version of sphinx is set from docs/requirements.txt\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n    \"sphinx.ext.autodoc\",\n    \"sphinx.ext.autosummary\",\n    \"sphinx.ext.doctest\",\n    \"sphinx.ext.intersphinx\",\n    \"sphinx.ext.todo\",\n    \"sphinx.ext.mathjax\",\n    \"sphinx.ext.napoleon\",\n    \"sphinx.ext.viewcode\",\n    \"sphinx.ext.duration\",\n    \"sphinx_gallery.gen_gallery\",\n    \"sphinx_copybutton\",\n]\n\nsphinx_gallery_conf = {\n    \"examples_dirs\": \"../../gallery/\",  # path to your example scripts\n    \"gallery_dirs\": \"auto_examples\",  # path to where to save gallery generated output\n    \"backreferences_dir\": \"gen_modules/backreferences\",\n    \"doc_module\": (\"torchvision\",),\n}\n\nnapoleon_use_ivar = True\nnapoleon_numpy_docstring = False\nnapoleon_google_docstring = True\n\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = [\"_templates\"]\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\nsource_suffix = {\n    \".rst\": \"restructuredtext\",\n}\n\n# The master toctree document.\nmaster_doc = \"index\"\n\n# General information about the project.\nproject = \"Torchvision\"\ncopyright = \"2017-present, Torch Contributors\"\nauthor = \"Torch Contributors\"\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = \"main (\" + torchvision.__version__ + \" )\"\n# The full version, including alpha/beta/rc tags.\nrelease = \"main\"\nVERSION = os.environ.get(\"VERSION\", None)\nif VERSION:\n    # Turn 1.11.0aHASH into 1.11 (major.minor only)\n    version = \".\".join(version.split(\".\")[:2])\n    html_title = \" \".join((project, version, \"documentation\"))\n    release = version\n\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This patterns also effect to html_static_path and html_extra_path\nexclude_patterns = []\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = \"sphinx\"\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = True\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes.\n#\nhtml_theme = \"pytorch_sphinx_theme\"\nhtml_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further.  For a list of options available for each theme, see the\n# documentation.\n#\nhtml_theme_options = {\n    \"collapse_navigation\": False,\n    \"display_version\": True,\n    \"logo_only\": True,\n    \"pytorch_project\": \"docs\",\n    \"navigation_with_keys\": True,\n    \"analytics_id\": \"UA-117752657-2\",\n}\n\nhtml_logo = \"_static/img/pytorch-logo-dark.svg\"\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = [\"_static\"]\n\n# TODO: remove this once https://github.com/pytorch/pytorch_sphinx_theme/issues/125 is fixed\nhtml_css_files = [\n    \"css/custom_torchvision.css\",\n]\n\n# -- Options for HTMLHelp output ------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = \"PyTorchdoc\"\n\n\nautosummary_generate = True\n\n\n# -- Options for LaTeX output ---------------------------------------------\nlatex_elements = {\n    # The paper size ('letterpaper' or 'a4paper').\n    #\n    # 'papersize': 'letterpaper',\n    # The font size ('10pt', '11pt' or '12pt').\n    #\n    # 'pointsize': '10pt',\n    # Additional stuff for the LaTeX preamble.\n    #\n    # 'preamble': '',\n    # Latex figure (float) alignment\n    #\n    # 'figure_align': 'htbp',\n}\n\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n#  author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n    (master_doc, \"pytorch.tex\", \"torchvision Documentation\", \"Torch Contributors\", \"manual\"),\n]\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [(master_doc, \"torchvision\", \"torchvision Documentation\", [author], 1)]\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n#  dir menu entry, description, category)\ntexinfo_documents = [\n    (\n        master_doc,\n        \"torchvision\",\n        \"torchvision Documentation\",\n        author,\n        \"torchvision\",\n        \"One line description of project.\",\n        \"Miscellaneous\",\n    ),\n]\n\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3/\", None),\n    \"torch\": (\"https://pytorch.org/docs/stable/\", None),\n    \"numpy\": (\"https://numpy.org/doc/stable/\", None),\n    \"PIL\": (\"https://pillow.readthedocs.io/en/stable/\", None),\n    \"matplotlib\": (\"https://matplotlib.org/stable/\", None),\n}\n\n# -- A patch that prevents Sphinx from cross-referencing ivar tags -------\n# See http://stackoverflow.com/a/41184353/3343043\n\nfrom docutils import nodes\nfrom sphinx import addnodes\nfrom sphinx.util.docfields import TypedField\n\n\ndef patched_make_field(self, types, domain, items, **kw):\n    # `kw` catches `env=None` needed for newer sphinx while maintaining\n    #  backwards compatibility when passed along further down!\n\n    # type: (list, unicode, tuple) -> nodes.field  # noqa: F821\n    def handle_item(fieldarg, content):\n        par = nodes.paragraph()\n        par += addnodes.literal_strong(\"\", fieldarg)  # Patch: this line added\n        # par.extend(self.make_xrefs(self.rolename, domain, fieldarg,\n        #                           addnodes.literal_strong))\n        if fieldarg in types:\n            par += nodes.Text(\" (\")\n            # NOTE: using .pop() here to prevent a single type node to be\n            # inserted twice into the doctree, which leads to\n            # inconsistencies later when references are resolved\n            fieldtype = types.pop(fieldarg)\n            if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):\n                typename = \"\".join(n.astext() for n in fieldtype)\n                typename = typename.replace(\"int\", \"python:int\")\n                typename = typename.replace(\"long\", \"python:long\")\n                typename = typename.replace(\"float\", \"python:float\")\n                typename = typename.replace(\"type\", \"python:type\")\n                par.extend(self.make_xrefs(self.typerolename, domain, typename, addnodes.literal_emphasis, **kw))\n            else:\n                par += fieldtype\n            par += nodes.Text(\")\")\n        par += nodes.Text(\" -- \")\n        par += content\n        return par\n\n    fieldname = nodes.field_name(\"\", self.label)\n    if len(items) == 1 and self.can_collapse:\n        fieldarg, content = items[0]\n        bodynode = handle_item(fieldarg, content)\n    else:\n        bodynode = self.list_type()\n        for fieldarg, content in items:\n            bodynode += nodes.list_item(\"\", handle_item(fieldarg, content))\n    fieldbody = nodes.field_body(\"\", bodynode)\n    return nodes.field(\"\", fieldname, fieldbody)\n\n\nTypedField.make_field = patched_make_field\n\n\ndef inject_minigalleries(app, what, name, obj, options, lines):\n    \"\"\"Inject a minigallery into a docstring.\n\n    This avoids having to manually write the .. minigallery directive for every item we want a minigallery for,\n    as it would be easy to miss some.\n\n    This callback is called after the .. auto directives (like ..autoclass) have been processed,\n    and modifies the lines parameter inplace to add the .. minigallery that will show which examples\n    are using which object.\n\n    It's a bit hacky, but not *that* hacky when you consider that the recommended way is to do pretty much the same,\n    but instead with templates using autosummary (which we don't want to use):\n    (https://sphinx-gallery.github.io/stable/configuration.html#auto-documenting-your-api-with-links-to-examples)\n\n    For docs on autodoc-process-docstring, see the autodoc docs:\n    https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html\n    \"\"\"\n\n    if what in (\"class\", \"function\"):\n        lines.append(f\".. minigallery:: {name}\")\n        lines.append(f\"    :add-heading: Examples using ``{name.split('.')[-1]}``:\")\n        # avoid heading entirely to avoid warning. As a bonud it actually renders better\n        lines.append(\"    :heading-level: 9\")\n        lines.append(\"\\n\")\n\n\ndef setup(app):\n    app.connect(\"autodoc-process-docstring\", inject_minigalleries)\n", "path": "docs/source/conf.py"}]}