微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Sphinx 将 torch.tensor 排除为 T

如何解决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 举报,一经查实,本站将立刻删除。