Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/main/apex/docs/source/conf.py
Views: 792
#!/usr/bin/env python31# -*- coding: utf-8 -*-2#3# PyTorch documentation build configuration file, created by4# sphinx-quickstart on Fri Dec 23 13:31:47 2016.5#6# This file is execfile()d with the current directory set to its7# containing dir.8#9# Note that not all possible configuration values are present in this10# autogenerated file.11#12# All configuration values have a default; values that are commented out13# serve to show the default.1415# 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 the17# documentation root, use os.path.abspath to make it absolute, like shown here.18#19import os20import sys21sys.path.insert(0, os.path.abspath('.'))22# sys.path.insert(0, os.path.abspath('../../apex/parallel/'))23import apex24# import multiproc25import sphinx_rtd_theme262728# -- General configuration ------------------------------------------------2930# If your documentation needs a minimal Sphinx version, state it here.31#32# needs_sphinx = '1.0'3334# Add any Sphinx extension module names here, as strings. They can be35# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom36# ones.37extensions = [38'sphinx.ext.autodoc',39'sphinx.ext.autosummary',40'sphinx.ext.doctest',41'sphinx.ext.intersphinx',42'sphinx.ext.todo',43'sphinx.ext.coverage',44'sphinx.ext.mathjax',45'sphinx.ext.napoleon',46'sphinx.ext.viewcode',47'sphinx.ext.extlinks',48]4950napoleon_use_ivar = True5152# Add any paths that contain templates here, relative to this directory.53templates_path = ['_templates']5455# The suffix(es) of source filenames.56# You can specify multiple suffix as a list of string:57#58# source_suffix = ['.rst', '.md']59source_suffix = '.rst'6061# The master toctree document.62master_doc = 'index'6364# General information about the project.65project = 'Apex'66copyright = '2018'67author = 'Christian Sarofeen, Natalia Gimelshein, Michael Carilli, Raul Puri'6869# The version info for the project you're documenting, acts as replacement for70# |version| and |release|, also used in various other places throughout the71# built documents.72#73# The short X.Y version.74# TODO: change to [:2] at v1.075# version = 'master (' + torch.__version__ + ' )'76version = '0.1'77# The full version, including alpha/beta/rc tags.78# TODO: verify this works as expected79release = '0.1.0'8081# The language for content autogenerated by Sphinx. Refer to documentation82# for a list of supported languages.83#84# This is also used if you do content translation via gettext catalogs.85# Usually you set "language" from the command line for these cases.86language = None8788# List of patterns, relative to source directory, that match files and89# directories to ignore when looking for source files.90# This pattern also affects html_static_path and html_extra_path91exclude_patterns = []9293# The name of the Pygments (syntax highlighting) style to use.94pygments_style = 'sphinx'9596# If true, `todo` and `todoList` produce output, else they produce nothing.97todo_include_todos = True9899100# -- Options for HTML output -------------------------------------------------101102# The theme to use for HTML and HTML Help pages. See the documentation for103# a list of builtin themes.104#105html_theme = 'sphinx_rtd_theme'106html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]107108# Theme options are theme-specific and customize the look and feel of a theme109# further. For a list of options available for each theme, see the110# documentation.111#112html_theme_options = {113'collapse_navigation': False,114'display_version': True,115'logo_only': True,116}117118# html_logo = '_static/img/nv-pytorch2.png'119120# Add any paths that contain custom static files (such as style sheets) here,121# relative to this directory. They are copied after the builtin static files,122# so a file named "default.css" will overwrite the builtin "default.css".123html_static_path = ['_static']124125# html_style_path = 'css/pytorch_theme.css'126html_context = {127'css_files': [128'https://fonts.googleapis.com/css?family=Lato',129'_static/css/pytorch_theme.css'130],131}132133134# -- Options for HTMLHelp output ---------------------------------------------135136# Output file base name for HTML help builder.137htmlhelp_basename = 'PyTorchdoc'138139140# -- Options for LaTeX output ------------------------------------------------141142latex_elements = {143# The paper size ('letterpaper' or 'a4paper').144#145# 'papersize': 'letterpaper',146147# The font size ('10pt', '11pt' or '12pt').148#149# 'pointsize': '10pt',150151# Additional stuff for the LaTeX preamble.152#153# 'preamble': '',154155# Latex figure (float) alignment156#157# 'figure_align': 'htbp',158}159160# Grouping the document tree into LaTeX files. List of tuples161# (source start file, target name, title,162# author, documentclass [howto, manual, or own class]).163latex_documents = [164(master_doc, 'apex.tex', 'Apex Documentation',165'Torch Contributors', 'manual'),166]167168169# -- Options for manual page output ------------------------------------------170171# One entry per manual page. List of tuples172# (source start file, name, description, authors, manual section).173man_pages = [174(master_doc, 'Apex', 'Apex Documentation',175[author], 1)176]177178179# -- Options for Texinfo output ----------------------------------------------180181# Grouping the document tree into Texinfo files. List of tuples182# (source start file, target name, title, author,183# dir menu entry, description, category)184texinfo_documents = [185(master_doc, 'Apex', 'Apex Documentation',186author, 'Apex', 'One line description of project.',187'Miscellaneous'),188]189190191# Example configuration for intersphinx: refer to the Python standard library.192intersphinx_mapping = {193'python': ('https://docs.python.org/', None),194'numpy': ('http://docs.scipy.org/doc/numpy/', None),195}196197# -- A patch that prevents Sphinx from cross-referencing ivar tags -------198# See http://stackoverflow.com/a/41184353/3343043199200from docutils import nodes201from sphinx.util.docfields import TypedField202from sphinx import addnodes203204205def patched_make_field(self, types, domain, items, **kw):206# `kw` catches `env=None` needed for newer sphinx while maintaining207# backwards compatibility when passed along further down!208209# type: (List, unicode, Tuple) -> nodes.field210def handle_item(fieldarg, content):211par = nodes.paragraph()212par += addnodes.literal_strong('', fieldarg) # Patch: this line added213# par.extend(self.make_xrefs(self.rolename, domain, fieldarg,214# addnodes.literal_strong))215if fieldarg in types:216par += nodes.Text(' (')217# NOTE: using .pop() here to prevent a single type node to be218# inserted twice into the doctree, which leads to219# inconsistencies later when references are resolved220fieldtype = types.pop(fieldarg)221if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):222typename = u''.join(n.astext() for n in fieldtype)223typename = typename.replace('int', 'python:int')224typename = typename.replace('long', 'python:long')225typename = typename.replace('float', 'python:float')226typename = typename.replace('type', 'python:type')227par.extend(self.make_xrefs(self.typerolename, domain, typename,228addnodes.literal_emphasis, **kw))229else:230par += fieldtype231par += nodes.Text(')')232par += nodes.Text(' -- ')233par += content234return par235236fieldname = nodes.field_name('', self.label)237if len(items) == 1 and self.can_collapse:238fieldarg, content = items[0]239bodynode = handle_item(fieldarg, content)240else:241bodynode = self.list_type()242for fieldarg, content in items:243bodynode += nodes.list_item('', handle_item(fieldarg, content))244fieldbody = nodes.field_body('', bodynode)245return nodes.field('', fieldname, fieldbody)246247TypedField.make_field = patched_make_field248249250