簡體   English   中英

如何從 Sphinx 自動類輸出中刪除“參數”部分

[英]How to remove the "Parameters" section from Sphinx autoclass output

使用autoclass記錄數據類時,您會在類文檔字符串之后獲得“參數”部分。 你怎么能去掉這個? 這是我想要實現的視覺效果:

在此處輸入圖像描述

編輯:這是示例中的類定義:

class Dense(Module):
  """A linear transformation applied over the last dimension of the input.

  Attributes:
    features: the number of output features.
    use_bias: whether to add a bias to the output (default: True).
    dtype: the dtype of the computation (default: infer from input and params).
    param_dtype: the dtype passed to parameter initializers (default: float32).
    precision: numerical precision of the computation see `jax.lax.Precision`
      for details.
  """
  features: int
  use_bias: bool = True
  dtype: Optional[Dtype] = None
  param_dtype: Dtype = jnp.float32
  precision: PrecisionLike = None
  kernel_init: Callable[[PRNGKey, Shape, Dtype], Array] = default_kernel_init
  bias_init: Callable[[PRNGKey, Shape, Dtype], Array] = zeros

我懷疑您的 Sphinx conf.py中有autodoc_typehints = "description" 如果您刪除它,它將使用默認signature設置,該設置不會顯示該參數部分。 這里

但是,如果您確實想保留autodoc_typehints = "description" ,則必須使用Args:Parameters:而不是Attributes: 我知道這也不完全正確,但這是一個修復。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM