[英]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.