Sphinx 将 torch.tensor 排除为 T

问题描述

我知道如何从 Sphinx 中排除文件

但是,我的一些代码使用了以下标准模式:

import torch.tensor as T

T 然后最终在我的模块中获得了 Torch 张量文档。我怎样才能避免这种情况?

我正在使用这些 sphinx 扩展:

extensions = [
    "sphinx.ext.autodoc","sphinx.ext.intersphinx","sphinx_rtd_theme",]

以下是来自 make html 的示例警告:

/Users/joseph/dev/torchsynth/torchsynth/parameter.py:docstring of torchsynth.parameter.T:1: WARNING: Inline emphasis start-string without end-string.
/Users/joseph/dev/torchsynth/torchsynth/util.py:docstring of torchsynth.util.T:1: WARNING: Inline emphasis start-string without end-string.

例如,在 torchsynth/parameter.py 中,导入是

from typing import Optional

import torch
import torch.nn as nn
from torch import tensor as T

这是github中的sphinx branch。我们刚刚开始编写我们的 sphinx 文档,所以请保持温和。

我们的 rst 文件现在只是骨架。例如,module.rst 是:

torchsynth
==========

.. toctree::
   :maxdepth: 4

   torchsynth

您可以在分支中看到其他 rst here

附上我的py-modindex.py的截图:

enter image description here

您可以在左上角看到浮动的“t”。加号/减号按钮过度缩放,我想我需要调整主题,但这不是我的问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)