We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Download buttons for all examples are broken for RTD
![Screenshot from 2020-06-11 19-10-01](https://user-images.githubusercontent.com/6849766/84418262-34e6fd00-ac17-11ea-8fdc-7a5cb5f9034d.png)

This is a bug in `sphinx-gallery` and should be fixed with sphinx-gallery/sphinx-gallery#706.

--- 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 # Configuration file for the Sphinx documentation builder.
2 #
3 # This file only contains a selection of the most common options. For a full list see
4 # the documentation:
5 # https://www.sphinx-doc.org/en/master/usage/configuration.html
6 
7 # -- Imports ---------------------------------------------------------------------------
8 
9 import os
10 import shutil
11 import warnings
12 from datetime import datetime
13 from distutils.util import strtobool
14 from os import path
15 from urllib.parse import urljoin
16 
17 from sphinx_gallery.sorting import ExampleTitleSortKey, ExplicitOrder
18 
19 import torch
20 
21 import pystiche
22 from pystiche.misc import download_file
23 
24 # -- Run config ------------------------------------------------------------------------
25 
26 
27 def get_bool_env_var(name, default=False):
28     try:
29         return bool(strtobool(os.environ[name]))
30     except KeyError:
31         return default
32 
33 
34 run_by_github_actions = get_bool_env_var("GITHUB_ACTIONS")
35 run_by_travis_ci = get_bool_env_var("TRAVIS")
36 run_by_appveyor = get_bool_env_var("APPVEYOR")
37 run_by_rtd = get_bool_env_var("READTHEDOCS")
38 run_by_ci = (
39     run_by_github_actions
40     or run_by_travis_ci
41     or run_by_appveyor
42     or run_by_rtd
43     or get_bool_env_var("CI")
44 )
45 
46 # -- Path setup ------------------------------------------------------------------------
47 
48 # If extensions (or modules to document with autodoc) are in another directory, add
49 # these directories to sys.path here. If the directory is relative to the documentation
50 # root, use os.path.abspath to make it absolute, like shown here.
51 #
52 # import os
53 # import sys
54 # sys.path.insert(0, os.path.abspath('.'))
55 
56 PROJECT_ROOT = path.abspath(path.join(path.dirname(__file__), "..", ".."))
57 
58 
59 # -- Project information ---------------------------------------------------------------
60 
61 project = pystiche.__name__
62 author = pystiche.__author__
63 copyright = f"2019 - {datetime.now().year}, {author}"
64 version = release = pystiche.__version__
65 
66 
67 # -- General configuration -------------------------------------------------------------
68 
69 # Add any Sphinx extension module names here, as strings. They can be extensions coming
70 # with Sphinx (named 'sphinx.ext.*') or your custom ones.
71 extensions = [
72     "sphinx.ext.autodoc",
73     "sphinx.ext.napoleon",
74     "sphinx.ext.coverage",
75     "sphinx.ext.intersphinx",
76     "sphinxcontrib.bibtex",
77     "sphinx_gallery.gen_gallery",
78     "sphinx_autodoc_typehints",
79 ]
80 
81 # Add any paths that contain templates here, relative to this directory.
82 templates_path = ["_templates"]
83 
84 # List of patterns, relative to source directory, that match files and directories to
85 # ignore when looking for source files. This pattern also affects html_static_path and
86 # html_extra_path.
87 exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
88 
89 # -- intersphinx configuration ---------------------------------------------------------
90 
91 intersphinx_mapping = {
92     "python": ("https://docs.python.org/3.6", None),
93     "torch": ("https://pytorch.org/docs/stable/", None),
94     "torchvision": ("https://pytorch.org/docs/stable/", None),
95     "PIL": ("https://pillow.readthedocs.io/en/stable/", None),
96     "numpy": ("https://numpy.org/doc/1.18/", None),
97     "requests": ("https://requests.readthedocs.io/en/stable/", None),
98     "matplotlib": ("https://matplotlib.org", None),
99 }
100 
101 
102 # -- sphinx-gallery configuration ------------------------------------------------------
103 
104 plot_gallery = get_bool_env_var("PYSTICHE_PLOT_GALLERY", default=True) and not run_by_ci
105 download_gallery = get_bool_env_var("PYSTICHE_DOWNLOAD_GALLERY") or run_by_ci
106 
107 if download_gallery:
108     base = "https://download.pystiche.org/galleries/"
109     file = (
110         "master.zip"
111         if pystiche.__is_dev_version__
112         else f"v{pystiche.__base_version__}.zip"
113     )
114 
115     url = urljoin(base, file)
116     print(f"Downloading pre-built galleries from {url}")
117     download_file(url, file)
118 
119     shutil.unpack_archive(file, extract_dir=".")
120     os.remove(file)
121 
122     extensions.remove("sphinx_gallery.gen_gallery")
123     extensions.append("sphinx_gallery.load_style")
124     plot_gallery = False
125 
126 if plot_gallery and not torch.cuda.is_available():
127     msg = (
128         "The galleries will be built, but CUDA is not available. "
129         "This will take a long time."
130     )
131     print(msg)
132 
133 
134 def show_cuda_memory(func):
135     torch.cuda.reset_peak_memory_stats()
136     out = func()
137 
138     stats = torch.cuda.memory_stats()
139     peak_bytes_usage = stats["allocated_bytes.all.peak"]
140     memory = peak_bytes_usage / 1024 ** 2
141 
142     return memory, out
143 
144 
145 class PysticheExampleTitleSortKey(ExampleTitleSortKey):
146     def __call__(self, filename):
147         # The beginner example *without* pystiche is placed before the example *with*
148         # to clarify the narrative.
149         if filename == "example_nst_without_pystiche.py":
150             return "1"
151         elif filename == "example_nst_with_pystiche.py":
152             return "2"
153         else:
154             return super().__call__(filename)
155 
156 
157 sphinx_gallery_conf = {
158     "examples_dirs": path.join(PROJECT_ROOT, "examples"),
159     "gallery_dirs": path.join("galleries", "examples"),
160     "filename_pattern": os.sep + "example_",
161     "line_numbers": True,
162     "remove_config_comments": True,
163     "plot_gallery": plot_gallery,
164     "subsection_order": ExplicitOrder(
165         [
166             path.join("..", "..", "examples", sub_gallery)
167             for sub_gallery in ("beginner", "advanced")
168         ]
169     ),
170     "within_subsection_order": PysticheExampleTitleSortKey,
171     "show_memory": show_cuda_memory if torch.cuda.is_available() else True,
172 }
173 
174 # Remove matplotlib agg warnings from generated doc when using plt.show
175 warnings.filterwarnings(
176     "ignore",
177     category=UserWarning,
178     message=(
179         "Matplotlib is currently using agg, which is a non-GUI backend, so cannot show "
180         "the figure."
181     ),
182 )
183 
184 
185 # -- Options for HTML output -----------------------------------------------------------
186 
187 # The theme to use for HTML and HTML Help pages.  See the documentation for a list of
188 # builtin themes.
189 html_theme = "sphinx_rtd_theme"
190 
191 # Add any paths that contain custom static files (such as style sheets) here, relative
192 # to this directory. They are copied after the builtin static files, so a file named
193 # "default.css" will overwrite the builtin "default.css".
194 # html_static_path = ["_static"]
195 
196 
197 # -- Latex / Mathjax config ------------------------------------------------------------
198 
199 with open("custom_cmds.tex", "r") as fh:
200     custom_cmds = fh.read()
201 
202 latex_elements = {"preamble": custom_cmds}
203 
204 mathjax_inline = [r"\(" + custom_cmds, r"\)"]
205 mathjax_display = [r"\[" + custom_cmds, r"\]"]
206
```
--- 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
@@ -7,6 +7,7 @@
 # -- Imports ---------------------------------------------------------------------------
 
 import os
+import re
 import shutil
 import warnings
 from datetime import datetime
@@ -116,9 +117,26 @@
     print(f"Downloading pre-built galleries from {url}")
     download_file(url, file)
 
+    try:
+        shutil.rmtree("galleries")
+    except FileNotFoundError:
+        pass
     shutil.unpack_archive(file, extract_dir=".")
     os.remove(file)
 
+    # This is workaround for a bug in sphinx-gallery that replaces absolute with
+    # relative paths. See https://github.com/pmeier/pystiche/pull/325 for details.
+    index_file = path.join("galleries", "examples", "index.rst")
+    with open(index_file, "r") as fh:
+        content = fh.read()
+    content = re.sub(
+        r"(?P<file>examples_(python|jupyter)\.zip) <[\w/.]+>",
+        r"\g<file> <\g<file>>",
+        content,
+    )
+    with open(index_file, "w") as fh:
+        fh.write(content)
+
     extensions.remove("sphinx_gallery.gen_gallery")
     extensions.append("sphinx_gallery.load_style")
     plot_gallery = False

{"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@@ -7,6 +7,7 @@\n # -- Imports ---------------------------------------------------------------------------\n \n import os\n+import re\n import shutil\n import warnings\n from datetime import datetime\n@@ -116,9 +117,26 @@\n     print(f\"Downloading pre-built galleries from {url}\")\n     download_file(url, file)\n \n+    try:\n+        shutil.rmtree(\"galleries\")\n+    except FileNotFoundError:\n+        pass\n     shutil.unpack_archive(file, extract_dir=\".\")\n     os.remove(file)\n \n+    # This is workaround for a bug in sphinx-gallery that replaces absolute with\n+    # relative paths. See https://github.com/pmeier/pystiche/pull/325 for details.\n+    index_file = path.join(\"galleries\", \"examples\", \"index.rst\")\n+    with open(index_file, \"r\") as fh:\n+        content = fh.read()\n+    content = re.sub(\n+        r\"(?P<file>examples_(python|jupyter)\\.zip) <[\\w/.]+>\",\n+        r\"\\g<file> <\\g<file>>\",\n+        content,\n+    )\n+    with open(index_file, \"w\") as fh:\n+        fh.write(content)\n+\n     extensions.remove(\"sphinx_gallery.gen_gallery\")\n     extensions.append(\"sphinx_gallery.load_style\")\n     plot_gallery = False\n", "issue": "Download buttons for all examples are broken for RTD\n![Screenshot from 2020-06-11 19-10-01](https://user-images.githubusercontent.com/6849766/84418262-34e6fd00-ac17-11ea-8fdc-7a5cb5f9034d.png)\r\n\r\nThis is a bug in `sphinx-gallery` and should be fixed with sphinx-gallery/sphinx-gallery#706.\n", "before_files": [{"content": "# Configuration file for the Sphinx documentation builder.\n#\n# This file only contains a selection of the most common options. For a full list see\n# the documentation:\n# https://www.sphinx-doc.org/en/master/usage/configuration.html\n\n# -- Imports ---------------------------------------------------------------------------\n\nimport os\nimport shutil\nimport warnings\nfrom datetime import datetime\nfrom distutils.util import strtobool\nfrom os import path\nfrom urllib.parse import urljoin\n\nfrom sphinx_gallery.sorting import ExampleTitleSortKey, ExplicitOrder\n\nimport torch\n\nimport pystiche\nfrom pystiche.misc import download_file\n\n# -- Run config ------------------------------------------------------------------------\n\n\ndef get_bool_env_var(name, default=False):\n    try:\n        return bool(strtobool(os.environ[name]))\n    except KeyError:\n        return default\n\n\nrun_by_github_actions = get_bool_env_var(\"GITHUB_ACTIONS\")\nrun_by_travis_ci = get_bool_env_var(\"TRAVIS\")\nrun_by_appveyor = get_bool_env_var(\"APPVEYOR\")\nrun_by_rtd = get_bool_env_var(\"READTHEDOCS\")\nrun_by_ci = (\n    run_by_github_actions\n    or run_by_travis_ci\n    or run_by_appveyor\n    or run_by_rtd\n    or get_bool_env_var(\"CI\")\n)\n\n# -- Path setup ------------------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory, add\n# these directories to sys.path here. If the directory is relative to the documentation\n# 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\nPROJECT_ROOT = path.abspath(path.join(path.dirname(__file__), \"..\", \"..\"))\n\n\n# -- Project information ---------------------------------------------------------------\n\nproject = pystiche.__name__\nauthor = pystiche.__author__\ncopyright = f\"2019 - {datetime.now().year}, {author}\"\nversion = release = pystiche.__version__\n\n\n# -- General configuration -------------------------------------------------------------\n\n# Add any Sphinx extension module names here, as strings. They can be extensions coming\n# with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = [\n    \"sphinx.ext.autodoc\",\n    \"sphinx.ext.napoleon\",\n    \"sphinx.ext.coverage\",\n    \"sphinx.ext.intersphinx\",\n    \"sphinxcontrib.bibtex\",\n    \"sphinx_gallery.gen_gallery\",\n    \"sphinx_autodoc_typehints\",\n]\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = [\"_templates\"]\n\n# List of patterns, relative to source directory, that match files and directories to\n# ignore when looking for source files. This pattern also affects html_static_path and\n# html_extra_path.\nexclude_patterns = [\"_build\", \"Thumbs.db\", \".DS_Store\"]\n\n# -- intersphinx configuration ---------------------------------------------------------\n\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3.6\", None),\n    \"torch\": (\"https://pytorch.org/docs/stable/\", None),\n    \"torchvision\": (\"https://pytorch.org/docs/stable/\", None),\n    \"PIL\": (\"https://pillow.readthedocs.io/en/stable/\", None),\n    \"numpy\": (\"https://numpy.org/doc/1.18/\", None),\n    \"requests\": (\"https://requests.readthedocs.io/en/stable/\", None),\n    \"matplotlib\": (\"https://matplotlib.org\", None),\n}\n\n\n# -- sphinx-gallery configuration ------------------------------------------------------\n\nplot_gallery = get_bool_env_var(\"PYSTICHE_PLOT_GALLERY\", default=True) and not run_by_ci\ndownload_gallery = get_bool_env_var(\"PYSTICHE_DOWNLOAD_GALLERY\") or run_by_ci\n\nif download_gallery:\n    base = \"https://download.pystiche.org/galleries/\"\n    file = (\n        \"master.zip\"\n        if pystiche.__is_dev_version__\n        else f\"v{pystiche.__base_version__}.zip\"\n    )\n\n    url = urljoin(base, file)\n    print(f\"Downloading pre-built galleries from {url}\")\n    download_file(url, file)\n\n    shutil.unpack_archive(file, extract_dir=\".\")\n    os.remove(file)\n\n    extensions.remove(\"sphinx_gallery.gen_gallery\")\n    extensions.append(\"sphinx_gallery.load_style\")\n    plot_gallery = False\n\nif plot_gallery and not torch.cuda.is_available():\n    msg = (\n        \"The galleries will be built, but CUDA is not available. \"\n        \"This will take a long time.\"\n    )\n    print(msg)\n\n\ndef show_cuda_memory(func):\n    torch.cuda.reset_peak_memory_stats()\n    out = func()\n\n    stats = torch.cuda.memory_stats()\n    peak_bytes_usage = stats[\"allocated_bytes.all.peak\"]\n    memory = peak_bytes_usage / 1024 ** 2\n\n    return memory, out\n\n\nclass PysticheExampleTitleSortKey(ExampleTitleSortKey):\n    def __call__(self, filename):\n        # The beginner example *without* pystiche is placed before the example *with*\n        # to clarify the narrative.\n        if filename == \"example_nst_without_pystiche.py\":\n            return \"1\"\n        elif filename == \"example_nst_with_pystiche.py\":\n            return \"2\"\n        else:\n            return super().__call__(filename)\n\n\nsphinx_gallery_conf = {\n    \"examples_dirs\": path.join(PROJECT_ROOT, \"examples\"),\n    \"gallery_dirs\": path.join(\"galleries\", \"examples\"),\n    \"filename_pattern\": os.sep + \"example_\",\n    \"line_numbers\": True,\n    \"remove_config_comments\": True,\n    \"plot_gallery\": plot_gallery,\n    \"subsection_order\": ExplicitOrder(\n        [\n            path.join(\"..\", \"..\", \"examples\", sub_gallery)\n            for sub_gallery in (\"beginner\", \"advanced\")\n        ]\n    ),\n    \"within_subsection_order\": PysticheExampleTitleSortKey,\n    \"show_memory\": show_cuda_memory if torch.cuda.is_available() else True,\n}\n\n# Remove matplotlib agg warnings from generated doc when using plt.show\nwarnings.filterwarnings(\n    \"ignore\",\n    category=UserWarning,\n    message=(\n        \"Matplotlib is currently using agg, which is a non-GUI backend, so cannot show \"\n        \"the figure.\"\n    ),\n)\n\n\n# -- Options for HTML output -----------------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for a list of\n# builtin themes.\nhtml_theme = \"sphinx_rtd_theme\"\n\n# Add any paths that contain custom static files (such as style sheets) here, relative\n# to this directory. They are copied after the builtin static files, so a file named\n# \"default.css\" will overwrite the builtin \"default.css\".\n# html_static_path = [\"_static\"]\n\n\n# -- Latex / Mathjax config ------------------------------------------------------------\n\nwith open(\"custom_cmds.tex\", \"r\") as fh:\n    custom_cmds = fh.read()\n\nlatex_elements = {\"preamble\": custom_cmds}\n\nmathjax_inline = [r\"\\(\" + custom_cmds, r\"\\)\"]\nmathjax_display = [r\"\\[\" + custom_cmds, r\"\\]\"]\n", "path": "docs/source/conf.py"}], "after_files": [{"content": "# Configuration file for the Sphinx documentation builder.\n#\n# This file only contains a selection of the most common options. For a full list see\n# the documentation:\n# https://www.sphinx-doc.org/en/master/usage/configuration.html\n\n# -- Imports ---------------------------------------------------------------------------\n\nimport os\nimport re\nimport shutil\nimport warnings\nfrom datetime import datetime\nfrom distutils.util import strtobool\nfrom os import path\nfrom urllib.parse import urljoin\n\nfrom sphinx_gallery.sorting import ExampleTitleSortKey, ExplicitOrder\n\nimport torch\n\nimport pystiche\nfrom pystiche.misc import download_file\n\n# -- Run config ------------------------------------------------------------------------\n\n\ndef get_bool_env_var(name, default=False):\n    try:\n        return bool(strtobool(os.environ[name]))\n    except KeyError:\n        return default\n\n\nrun_by_github_actions = get_bool_env_var(\"GITHUB_ACTIONS\")\nrun_by_travis_ci = get_bool_env_var(\"TRAVIS\")\nrun_by_appveyor = get_bool_env_var(\"APPVEYOR\")\nrun_by_rtd = get_bool_env_var(\"READTHEDOCS\")\nrun_by_ci = (\n    run_by_github_actions\n    or run_by_travis_ci\n    or run_by_appveyor\n    or run_by_rtd\n    or get_bool_env_var(\"CI\")\n)\n\n# -- Path setup ------------------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory, add\n# these directories to sys.path here. If the directory is relative to the documentation\n# 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\nPROJECT_ROOT = path.abspath(path.join(path.dirname(__file__), \"..\", \"..\"))\n\n\n# -- Project information ---------------------------------------------------------------\n\nproject = pystiche.__name__\nauthor = pystiche.__author__\ncopyright = f\"2019 - {datetime.now().year}, {author}\"\nversion = release = pystiche.__version__\n\n\n# -- General configuration -------------------------------------------------------------\n\n# Add any Sphinx extension module names here, as strings. They can be extensions coming\n# with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = [\n    \"sphinx.ext.autodoc\",\n    \"sphinx.ext.napoleon\",\n    \"sphinx.ext.coverage\",\n    \"sphinx.ext.intersphinx\",\n    \"sphinxcontrib.bibtex\",\n    \"sphinx_gallery.gen_gallery\",\n    \"sphinx_autodoc_typehints\",\n]\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = [\"_templates\"]\n\n# List of patterns, relative to source directory, that match files and directories to\n# ignore when looking for source files. This pattern also affects html_static_path and\n# html_extra_path.\nexclude_patterns = [\"_build\", \"Thumbs.db\", \".DS_Store\"]\n\n# -- intersphinx configuration ---------------------------------------------------------\n\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3.6\", None),\n    \"torch\": (\"https://pytorch.org/docs/stable/\", None),\n    \"torchvision\": (\"https://pytorch.org/docs/stable/\", None),\n    \"PIL\": (\"https://pillow.readthedocs.io/en/stable/\", None),\n    \"numpy\": (\"https://numpy.org/doc/1.18/\", None),\n    \"requests\": (\"https://requests.readthedocs.io/en/stable/\", None),\n    \"matplotlib\": (\"https://matplotlib.org\", None),\n}\n\n\n# -- sphinx-gallery configuration ------------------------------------------------------\n\nplot_gallery = get_bool_env_var(\"PYSTICHE_PLOT_GALLERY\", default=True) and not run_by_ci\ndownload_gallery = get_bool_env_var(\"PYSTICHE_DOWNLOAD_GALLERY\") or run_by_ci\n\nif download_gallery:\n    base = \"https://download.pystiche.org/galleries/\"\n    file = (\n        \"master.zip\"\n        if pystiche.__is_dev_version__\n        else f\"v{pystiche.__base_version__}.zip\"\n    )\n\n    url = urljoin(base, file)\n    print(f\"Downloading pre-built galleries from {url}\")\n    download_file(url, file)\n\n    try:\n        shutil.rmtree(\"galleries\")\n    except FileNotFoundError:\n        pass\n    shutil.unpack_archive(file, extract_dir=\".\")\n    os.remove(file)\n\n    # This is workaround for a bug in sphinx-gallery that replaces absolute with\n    # relative paths. See https://github.com/pmeier/pystiche/pull/325 for details.\n    index_file = path.join(\"galleries\", \"examples\", \"index.rst\")\n    with open(index_file, \"r\") as fh:\n        content = fh.read()\n    content = re.sub(\n        r\"(?P<file>examples_(python|jupyter)\\.zip) <[\\w/.]+>\",\n        r\"\\g<file> <\\g<file>>\",\n        content,\n    )\n    with open(index_file, \"w\") as fh:\n        fh.write(content)\n\n    extensions.remove(\"sphinx_gallery.gen_gallery\")\n    extensions.append(\"sphinx_gallery.load_style\")\n    plot_gallery = False\n\nif plot_gallery and not torch.cuda.is_available():\n    msg = (\n        \"The galleries will be built, but CUDA is not available. \"\n        \"This will take a long time.\"\n    )\n    print(msg)\n\n\ndef show_cuda_memory(func):\n    torch.cuda.reset_peak_memory_stats()\n    out = func()\n\n    stats = torch.cuda.memory_stats()\n    peak_bytes_usage = stats[\"allocated_bytes.all.peak\"]\n    memory = peak_bytes_usage / 1024 ** 2\n\n    return memory, out\n\n\nclass PysticheExampleTitleSortKey(ExampleTitleSortKey):\n    def __call__(self, filename):\n        # The beginner example *without* pystiche is placed before the example *with*\n        # to clarify the narrative.\n        if filename == \"example_nst_without_pystiche.py\":\n            return \"1\"\n        elif filename == \"example_nst_with_pystiche.py\":\n            return \"2\"\n        else:\n            return super().__call__(filename)\n\n\nsphinx_gallery_conf = {\n    \"examples_dirs\": path.join(PROJECT_ROOT, \"examples\"),\n    \"gallery_dirs\": path.join(\"galleries\", \"examples\"),\n    \"filename_pattern\": os.sep + \"example_\",\n    \"line_numbers\": True,\n    \"remove_config_comments\": True,\n    \"plot_gallery\": plot_gallery,\n    \"subsection_order\": ExplicitOrder(\n        [\n            path.join(\"..\", \"..\", \"examples\", sub_gallery)\n            for sub_gallery in (\"beginner\", \"advanced\")\n        ]\n    ),\n    \"within_subsection_order\": PysticheExampleTitleSortKey,\n    \"show_memory\": show_cuda_memory if torch.cuda.is_available() else True,\n}\n\n# Remove matplotlib agg warnings from generated doc when using plt.show\nwarnings.filterwarnings(\n    \"ignore\",\n    category=UserWarning,\n    message=(\n        \"Matplotlib is currently using agg, which is a non-GUI backend, so cannot show \"\n        \"the figure.\"\n    ),\n)\n\n\n# -- Options for HTML output -----------------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for a list of\n# builtin themes.\nhtml_theme = \"sphinx_rtd_theme\"\n\n# Add any paths that contain custom static files (such as style sheets) here, relative\n# to this directory. They are copied after the builtin static files, so a file named\n# \"default.css\" will overwrite the builtin \"default.css\".\n# html_static_path = [\"_static\"]\n\n\n# -- Latex / Mathjax config ------------------------------------------------------------\n\nwith open(\"custom_cmds.tex\", \"r\") as fh:\n    custom_cmds = fh.read()\n\nlatex_elements = {\"preamble\": custom_cmds}\n\nmathjax_inline = [r\"\\(\" + custom_cmds, r\"\\)\"]\nmathjax_display = [r\"\\[\" + custom_cmds, r\"\\]\"]\n", "path": "docs/source/conf.py"}]}