conf.py 2.49 KB
Newer Older
gaoqiong's avatar
gaoqiong committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.

import os
import shutil
import sys

import onnxruntime

# import recommonmark

# -- Project information -----------------------------------------------------

project = "ONNX Runtime"
copyright = "2018-2021, Microsoft"
author = "Microsoft"
version = onnxruntime.__version__
release = version

# -- General configuration ---------------------------------------------------

extensions = [
    "alabaster",
    "sphinx.ext.intersphinx",
    "sphinx.ext.imgmath",
    "sphinx.ext.ifconfig",
    "sphinx.ext.viewcode",
    "sphinx.ext.autodoc",
    "sphinx.ext.githubpages",
    "sphinx_gallery.gen_gallery",
    "sphinx.ext.graphviz",
    "pyquickhelper.sphinxext.sphinx_runpython_extension",
]

templates_path = ["_templates"]

source_parsers = {
    ".md": "recommonmark.parser.CommonMarkParser",
}

source_suffix = [".rst"]  # , '.md']

master_doc = "index"
language = "en"
exclude_patterns = []
pygments_style = "default"
autoclass_content = "both"

# -- Options for HTML output -------------------------------------------------

html_theme = "alabaster"
html_logo = "ONNX_Runtime_icon.png"
html_static_path = ["_static"]
graphviz_output_format = "svg"

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/": None}

# -- Options for Sphinx Gallery ----------------------------------------------

sphinx_gallery_conf = {
    "examples_dirs": "examples",
    "gallery_dirs": "auto_examples",
}

# -- markdown options -----------------------------------------------------------

md_image_dest = "media"
md_link_replace = {
    "#onnxruntimesessionoptionsenable-profiling)": "#class-onnxruntimesessionoptions)",
}

# -- Setup actions -----------------------------------------------------------


def setup(app):
    # download examples for the documentation
    this = os.path.abspath(os.path.dirname(__file__))
    dest = os.path.join(this, "model.onnx")
    if not os.path.exists(dest):
        import urllib.request

        url = "https://raw.githubusercontent.com/onnx/onnx/master/onnx/backend/test/data/node/test_sigmoid/model.onnx"
        urllib.request.urlretrieve(url, dest)
    loc = os.path.split(dest)[-1]
    if not os.path.exists(loc):
        import shutil

        shutil.copy(dest, loc)
    return app