| 1 |
#!/usr/bin/env python3 |
| 2 |
############################################################################ |
| 3 |
# Copyright (C) Intel Corporation |
| 4 |
# |
| 5 |
# SPDX-License-Identifier: MIT |
| 6 |
############################################################################ |
| 7 |
""" |
| 8 |
Common configuration for building specification. |
| 9 |
""" |
| 10 |
# pylint: disable=invalid-name |
| 11 |
|
| 12 |
# Derived from: |
| 13 |
# github.com/oneapi-src/oneAPI-spec/blob/main/source/conf/common_conf.py |
| 14 |
|
| 15 |
import string |
| 16 |
import docutils |
| 17 |
|
| 18 |
# The language for content autogenerated by Sphinx. Refer to documentation |
| 19 |
# for a list of supported languages. |
| 20 |
# |
| 21 |
# This is also used if you do content translation via gettext catalogs. |
| 22 |
# Usually you set "language" from the command line for these cases. |
| 23 |
language = 'en' |
| 24 |
|
| 25 |
extensions = [ |
| 26 |
'sphinx.ext.autodoc', |
| 27 |
'sphinx.ext.doctest', |
| 28 |
'sphinx.ext.todo', |
| 29 |
'sphinx.ext.coverage', |
| 30 |
'sphinx.ext.mathjax', |
| 31 |
'sphinx.ext.ifconfig', |
| 32 |
'sphinx.ext.viewcode', |
| 33 |
'sphinx.ext.githubpages', |
| 34 |
'sphinx.ext.graphviz', |
| 35 |
'sphinxcontrib.spelling', |
| 36 |
'sphinxcontrib.inkscapeconverter', |
| 37 |
'sphinxmark', |
| 38 |
'sphinx-prompt', |
| 39 |
'sphinx_substitution_extensions', |
| 40 |
'sphinxcontrib.plantuml', |
| 41 |
'breathe', |
| 42 |
] |
| 43 |
|
| 44 |
env = { |
| 45 |
'vpl_spec_version': "2.16.0", |
| 46 |
} |
| 47 |
|
| 48 |
prolog_template = string.Template(r""" |
| 49 |
|
| 50 |
.. |vpl_full_name| replace:: Intel\ :supsub:`reg` Video Processing Library |
| 51 |
.. |vpl_short_name| replace:: Intel\ :supsub:`reg` VPL |
| 52 |
.. |vpl_version| replace:: $vpl_spec_version |
| 53 |
.. include:: <isonum.txt> |
| 54 |
.. |regsup| replace:: :supsub:`reg` |
| 55 |
.. |intel_r| replace:: Intel\ :supsub:`reg` |
| 56 |
.. |msdk_full_name| replace:: Intel\ :supsub:`reg`""" + |
| 57 |
' Media Software Development Kit') |
| 58 |
|
| 59 |
rst_prolog = prolog_template.substitute(env) |
| 60 |
|
| 61 |
# for substitutions in code blocks and sphinx-prompts: |
| 62 |
substitutions = [] |
| 63 |
|
| 64 |
primary_domain = 'cpp' |
| 65 |
|
| 66 |
latex_elements = { |
| 67 |
'preamble': r''' |
| 68 |
\usepackage{makeidx} |
| 69 |
\usepackage[columns=1]{idxlayout} |
| 70 |
\makeindex |
| 71 |
\DeclareUnicodeCharacter{2208}{$\in$} |
| 72 |
\DeclareUnicodeCharacter{2212}{$-$} |
| 73 |
\DeclareUnicodeCharacter{222A}{$\cup$} |
| 74 |
\DeclareUnicodeCharacter{2236}{$\colon$} |
| 75 |
\DeclareUnicodeCharacter{2260}{$\neq$} |
| 76 |
\DeclareUnicodeCharacter{2264}{$\leq$} |
| 77 |
\DeclareUnicodeCharacter{2265}{$\geq$} |
| 78 |
\DeclareUnicodeCharacter{3B3}{$\gamma$} |
| 79 |
\DeclareUnicodeCharacter{39B}{$\Lambda$} |
| 80 |
\DeclareUnicodeCharacter{3A3}{$\Sigma$} |
| 81 |
\DeclareUnicodeCharacter{3A6}{$\phi$} |
| 82 |
\DeclareUnicodeCharacter{3B1}{$\alpha$} |
| 83 |
\DeclareUnicodeCharacter{3B2}{$\beta$} |
| 84 |
\DeclareUnicodeCharacter{3B4}{$\delta$} |
| 85 |
\DeclareUnicodeCharacter{3BB}{$\lambda$} |
| 86 |
\DeclareUnicodeCharacter{3BC}{$\mu$} |
| 87 |
\DeclareUnicodeCharacter{3BD}{$\nu$} |
| 88 |
\DeclareUnicodeCharacter{3C0}{$\pi$} |
| 89 |
\DeclareUnicodeCharacter{3C3}{$\sigma$} |
| 90 |
\DeclareUnicodeCharacter{FB01}{$fi$} |
| 91 |
\DeclareUnicodeCharacter{FB02}{$fl$} |
| 92 |
\newcommand{\src}{\operatorname{src}} |
| 93 |
\newcommand{\srclayer}{\operatorname{src\_layer}} |
| 94 |
\newcommand{\srciter}{\operatorname{src\_iter}} |
| 95 |
\newcommand{\srciterc}{\operatorname{src\_iter\_c}} |
| 96 |
\newcommand{\weights}{\operatorname{weights}} |
| 97 |
\newcommand{\weightslayer}{\operatorname{weights\_layer}} |
| 98 |
\newcommand{\weightsiter}{\operatorname{weights\_iter}} |
| 99 |
\newcommand{\weightspeephole}{\operatorname{weights\_peephole}} |
| 100 |
\newcommand{\weightsprojection}{\operatorname{weights\_projection}} |
| 101 |
\newcommand{\bias}{\operatorname{bias}} |
| 102 |
\newcommand{\dst}{\operatorname{dst}} |
| 103 |
\newcommand{\dstlayer}{\operatorname{dst\_layer}} |
| 104 |
\newcommand{\dstiter}{\operatorname{dst\_iter}} |
| 105 |
\newcommand{\dstiterc}{\operatorname{dst\_iter\_c}} |
| 106 |
\newcommand{\diffsrc}{\operatorname{diff\_src}} |
| 107 |
\newcommand{\diffsrclayer}{\operatorname{diff\_src\_layer}} |
| 108 |
\newcommand{\diffsrciter}{\operatorname{diff\_src\_iter}} |
| 109 |
\newcommand{\diffsrciterc}{\operatorname{diff\_src\_iter\_c}} |
| 110 |
\newcommand{\diffweights}{\operatorname{diff\_weights}} |
| 111 |
\newcommand{\diffweightslayer}{\operatorname{diff\_weights\_layer}} |
| 112 |
\newcommand{\diffweightsiter}{\operatorname{diff\_weights\_iter}} |
| 113 |
\newcommand{\diffweightspeephole}{\operatorname{diff\_weights\_peephole}} |
| 114 |
\newcommand{\diffweightsprojection}{\operatorname{diff\_weights\_projection}} |
| 115 |
\newcommand{\diffbias}{\operatorname{diff\_bias}} |
| 116 |
\newcommand{\diffdst}{\operatorname{diff\_dst}} |
| 117 |
\newcommand{\diffdstlayer}{\operatorname{diff\_dst\_layer}} |
| 118 |
\newcommand{\diffdstiter}{\operatorname{diff\_dst\_iter}} |
| 119 |
\newcommand{\diffdstiterc}{\operatorname{diff\_dst\_iter\_c}} |
| 120 |
\newcommand{\diffgamma}{\operatorname{diff\_\gamma}} |
| 121 |
\newcommand{\diffbeta}{\operatorname{diff\_\beta}} |
| 122 |
\newcommand{\workspace}{\operatorname{workspace}} |
| 123 |
\newcommand{\srcshape}{\operatorname{src\_shape}} |
| 124 |
''', |
| 125 |
# Latex figure (float) alignment |
| 126 |
# |
| 127 |
# 'figure_align': 'htbp', |
| 128 |
'extraclassoptions': 'openany,oneside', |
| 129 |
} |
| 130 |
|
| 131 |
imgmath_latex_preamble = r''' |
| 132 |
\newcommand{\src}{\operatorname{src}} |
| 133 |
\newcommand{\srclayer}{\operatorname{src\_layer}} |
| 134 |
\newcommand{\srciter}{\operatorname{src\_iter}} |
| 135 |
\newcommand{\srciterc}{\operatorname{src\_iter\_c}} |
| 136 |
\newcommand{\weights}{\operatorname{weights}} |
| 137 |
\newcommand{\weightslayer}{\operatorname{weights\_layer}} |
| 138 |
\newcommand{\weightsiter}{\operatorname{weights\_iter}} |
| 139 |
\newcommand{\weightspeephole}{\operatorname{weights\_peephole}} |
| 140 |
\newcommand{\weightsprojection}{\operatorname{weights\_projection}} |
| 141 |
\newcommand{\bias}{\operatorname{bias}} |
| 142 |
\newcommand{\dst}{\operatorname{dst}} |
| 143 |
\newcommand{\dstlayer}{\operatorname{dst\_layer}} |
| 144 |
\newcommand{\dstiter}{\operatorname{dst\_iter}} |
| 145 |
\newcommand{\dstiterc}{\operatorname{dst\_iter\_c}} |
| 146 |
\newcommand{\diffsrc}{\operatorname{diff\_src}} |
| 147 |
\newcommand{\diffsrclayer}{\operatorname{diff\_src\_layer}} |
| 148 |
\newcommand{\diffsrciter}{\operatorname{diff\_src\_iter}} |
| 149 |
\newcommand{\diffsrciterc}{\operatorname{diff\_src\_iter\_c}} |
| 150 |
\newcommand{\diffweights}{\operatorname{diff\_weights}} |
| 151 |
\newcommand{\diffweightslayer}{\operatorname{diff\_weights\_layer}} |
| 152 |
\newcommand{\diffweightsiter}{\operatorname{diff\_weights\_iter}} |
| 153 |
\newcommand{\diffweightspeephole}{\operatorname{diff\_weights\_peephole}} |
| 154 |
\newcommand{\diffweightsprojection}{\operatorname{diff\_weights\_projection}} |
| 155 |
\newcommand{\diffbias}{\operatorname{diff\_bias}} |
| 156 |
\newcommand{\diffdst}{\operatorname{diff\_dst}} |
| 157 |
\newcommand{\diffdstlayer}{\operatorname{diff\_dst\_layer}} |
| 158 |
\newcommand{\diffdstiter}{\operatorname{diff\_dst\_iter}} |
| 159 |
\newcommand{\diffdstiterc}{\operatorname{diff\_dst\_iter\_c}} |
| 160 |
\newcommand{\diffgamma}{\operatorname{diff\_\gamma}} |
| 161 |
\newcommand{\diffbeta}{\operatorname{diff\_\beta}} |
| 162 |
\newcommand{\workspace}{\operatorname{workspace}} |
| 163 |
\newcommand{\srcshape}{\operatorname{src\_shape}} |
| 164 |
''' |
| 165 |
|
| 166 |
mathjax3_config = { |
| 167 |
'tex': { |
| 168 |
'macros': { |
| 169 |
'src': '\\operatorname{src}', |
| 170 |
'srclayer': '\\operatorname{src\\_layer}', |
| 171 |
'srciter': '\\operatorname{src\\_iter}', |
| 172 |
'srciterc': '\\operatorname{src\\_iter\\_c}', |
| 173 |
'weights': '\\operatorname{weights}', |
| 174 |
'weightslayer': '\\operatorname{weights\\_layer}', |
| 175 |
'weightsiter': '\\operatorname{weights\\_iter}', |
| 176 |
'weightspeephole': '\\operatorname{weights\\_peephole}', |
| 177 |
'weightsprojection': '\\operatorname{weights\\_projection}', |
| 178 |
'bias': '\\operatorname{bias}', |
| 179 |
'dst': '\\operatorname{dst}', |
| 180 |
'dstlayer': '\\operatorname{dst\\_layer}', |
| 181 |
'dstiter': '\\operatorname{dst\\_iter}', |
| 182 |
'dstiterc': '\\operatorname{dst\\_iter\\_c}', |
| 183 |
'diffsrc': '\\operatorname{diff\\_src}', |
| 184 |
'diffsrclayer': '\\operatorname{diff\\_src\\_layer}', |
| 185 |
'diffsrciter': '\\operatorname{diff\\_src\\_iter}', |
| 186 |
'diffsrciterc': '\\operatorname{diff\\_src\\_iter\\_c}', |
| 187 |
'diffweights': '\\operatorname{diff\\_weights}', |
| 188 |
'diffweightslayer': '\\operatorname{diff\\_weights\\_layer}', |
| 189 |
'diffweightsiter': '\\operatorname{diff\\_weights\\_iter}', |
| 190 |
'diffweightspeephole': '\\operatorname{diff\\_weights\\_peephole}', |
| 191 |
'diffweightsprojection': |
| 192 |
'\\operatorname{diff\\_weights\\_projection}', # noqa: E501 |
| 193 |
'diffbias': '\\operatorname{diff\\_bias}', |
| 194 |
'diffdst': '\\operatorname{diff\\_dst}', |
| 195 |
'diffdstlayer': '\\operatorname{diff\\_dst\\_layer}', |
| 196 |
'diffdstiter': '\\operatorname{diff\\_dst\\_iter}', |
| 197 |
'diffdstiterc': '\\operatorname{diff\\_dst\\_iter\\_c}', |
| 198 |
'diffgamma': '\\operatorname{diff\\_\\gamma}', |
| 199 |
'diffbeta': '\\operatorname{diff\\_\\beta}', |
| 200 |
'workspace': '\\operatorname{workspace}', |
| 201 |
'srcshape': '\\operatorname{src\\_shape}', |
| 202 |
} |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
|
| 207 |
def supsub_role(_name, |
| 208 |
_rawtext, |
| 209 |
text, |
| 210 |
_lineno, |
| 211 |
_inliner, |
| 212 |
_options=None, |
| 213 |
_content=None): |
| 214 |
"""Superscript substitution""" |
| 215 |
node = docutils.nodes.superscript() |
| 216 |
node2 = docutils.nodes.substitution_reference(refname=text) |
| 217 |
node += [node2] |
| 218 |
return [node], [] |
| 219 |
|
| 220 |
|
| 221 |
def setup(app): |
| 222 |
"""Setup""" |
| 223 |
app.add_role('supsub', supsub_role) |
| 224 |
app.add_css_file('custom.css') |