onnxruntime
129 строк · 3.7 Кб
1# Copyright (c) Microsoft Corporation. All rights reserved.
2# Licensed under the MIT License.
3# pylint: disable=C0103
4
5"""Configuration file for the Sphinx documentation builder."""
6
7import os
8import shutil
9import sys
10
11sys.path.append(os.path.join(os.path.dirname(__file__), "..", "_common"))
12
13# import recommonmark
14
15# -- Project information -----------------------------------------------------
16
17project = "Python API"
18copyright = "2018-2024, Microsoft"
19author = "Microsoft"
20
21# -- General configuration ---------------------------------------------------
22
23extensions = [
24"sphinx.ext.intersphinx",
25"sphinx.ext.imgmath",
26"sphinx.ext.ifconfig",
27"sphinx.ext.viewcode",
28"sphinx.ext.autodoc",
29"sphinx.ext.githubpages",
30"sphinx_gallery.gen_gallery",
31"sphinx.ext.graphviz",
32"pyquickhelper.sphinxext.sphinx_runpython_extension",
33"sphinxcontrib.googleanalytics",
34"sphinx.ext.napoleon",
35]
36
37templates_path = ["_templates"]
38
39source_parsers = {
40".md": "recommonmark.parser.CommonMarkParser",
41}
42
43source_suffix = [".rst"] # , '.md']
44
45master_doc = "index"
46language = "en"
47exclude_patterns = []
48pygments_style = "default"
49autoclass_content = "both"
50master_doc = "index"
51onnx_doc_folder = os.path.join(os.path.abspath(os.path.dirname(__file__)), "operators")
52pygments_style = "sphinx"
53
54# -- Options for HTML output -------------------------------------------------
55
56html_logo = "ONNX_Runtime_icon.png"
57html_static_path = ["_static"]
58html_theme = "furo"
59graphviz_output_format = "svg"
60
61html_context = {
62"default_mode": "auto", # auto: the documentation theme will follow the system default that you have set (light or dark)
63}
64
65html_theme_options = {
66"collapse_navigation": True,
67"external_links": [
68{"name": "onnxruntime", "url": "https://onnxruntime.ai/"},
69{"name": "github", "url": "https://github.com/microsoft/onnxruntime"},
70],
71"github_url": "https://github.com/microsoft/onnxruntime",
72"navbar_center": [],
73"navigation_depth": 5,
74"page_sidebar_items": [], # default setting is: ["page-toc", "edit-this-page", "sourcelink"],
75"show_nav_level": 0,
76"show_prev_next": True,
77"show_toc_level": 0,
78# needed for sphinx 6.0
79"logo": {
80"text": project,
81"image_light": html_logo,
82"image_dark": html_logo,
83"alt_text": project,
84},
85}
86
87# -- Options for Google Analytics -------------------------------------------------
88
89googleanalytics_id = "UA-156955408-1"
90
91# -- Options for intersphinx extension ---------------------------------------
92
93# Example configuration for intersphinx: refer to the Python standard library.
94intersphinx_mapping = {
95"python": ("https://docs.python.org/3", None),
96"numpy": ("https://numpy.org/doc/stable", None),
97"torch": ("https://pytorch.org/docs/stable/", None),
98}
99
100# -- Options for Sphinx Gallery ----------------------------------------------
101
102sphinx_gallery_conf = {
103"examples_dirs": "examples",
104"gallery_dirs": "auto_examples",
105}
106
107# -- markdown options -----------------------------------------------------------
108
109md_image_dest = "media"
110md_link_replace = {
111"#onnxruntimesessionoptionsenable-profiling)": "#class-onnxruntimesessionoptions)",
112}
113
114# -- Setup actions -----------------------------------------------------------
115
116
117def setup(app):
118# download examples for the documentation
119this = os.path.abspath(os.path.dirname(__file__))
120dest = os.path.join(this, "model.onnx")
121if not os.path.exists(dest):
122import urllib.request
123
124url = "https://raw.githubusercontent.com/onnx/onnx/master/onnx/backend/test/data/node/test_sigmoid/model.onnx"
125urllib.request.urlretrieve(url, dest)
126loc = os.path.split(dest)[-1]
127if not os.path.exists(loc):
128shutil.copy(dest, loc)
129return app
130