Add pydocstyle to the ruff rules (#52136)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <hej.mellor@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-09-16 16:44:29 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 804e5377aa
commit 8c1557a79c
2002 changed files with 15024 additions and 14269 deletions
@@ -590,8 +590,7 @@ def fused_recurrent_gated_delta_rule(
num_accepted_tokens: torch.Tensor | None = None,
use_qk_l2norm_in_kernel: bool = False,
) -> tuple[torch.Tensor, torch.Tensor]:
r"""
Args:
r"""Args:
q (torch.Tensor):
queries of shape `[B, T, H, K]`.
k (torch.Tensor):
@@ -653,6 +652,7 @@ def fused_recurrent_gated_delta_rule(
initial_state=h0,
cu_seqlens=cu_seqlens
)
"""
if cu_seqlens is not None and q.shape[0] != 1:
raise ValueError(
+17 -12
View File
@@ -416,19 +416,24 @@ def chunk_kda_scaled_dot_kkt_fwd(
chunk_size: int = FLA_CHUNK_SIZE,
output_dtype: torch.dtype = torch.float32,
) -> tuple[torch.Tensor, torch.Tensor]:
r"""
Compute beta * K * K^T.
r"""Compute beta * K * K^T.
Args:
q (torch.Tensor):
The query tensor of shape `[B, T, H, K]`.
k (torch.Tensor):
The key tensor of shape `[B, T, H, K]`.
beta (torch.Tensor):
The beta tensor of shape `[B, T, H]`.
gk (torch.Tensor):
The cumulative sum of the gate tensor of shape `[B, T, H, K]` applied to the key tensor. Default: `None`.
scale (float):
Scale applied to the query-key products. Default: `None`.
cu_seqlens (torch.Tensor):
The cumulative sequence lengths of the input tensor.
Default: None
chunk_indices (torch.Tensor):
Precomputed chunk indices for `cu_seqlens`. Default: `None`.
chunk_size (int):
The chunk size. Default: 64.
output_dtype (torch.dtype):
@@ -436,6 +441,7 @@ def chunk_kda_scaled_dot_kkt_fwd(
Returns:
beta * K * K^T of shape `[B, T, H, BT]` where `BT` is the chunk size.
"""
B, T, H, K = k.shape
assert K <= 256
@@ -1328,16 +1334,15 @@ def fused_kda_gate(
safe_gate: bool = False,
lower_bound: float | None = -5.0,
) -> torch.Tensor:
"""
Forward pass for KDA gate:
input g: [..., H*D]
param A: [H] or [1, 1, H, 1]
beta: softplus beta parameter (softplus branch only)
threshold: softplus threshold parameter (softplus branch only)
safe_gate: when False (default) compute y = -exp(A)*softplus(g+g_bias);
when True compute the bounded y = lower_bound*sigmoid(exp(A)*(g+g_bias))
lower_bound: floor for the safe_gate branch (default -5.0)
return : [..., H, D]
"""Forward pass for KDA gate:
input g: [..., H*D]
param A: [H] or [1, 1, H, 1]
beta: softplus beta parameter (softplus branch only)
threshold: softplus threshold parameter (softplus branch only)
safe_gate: when False (default) compute y = -exp(A)*softplus(g+g_bias);
when True compute the bounded y = lower_bound*sigmoid(exp(A)*(g+g_bias))
lower_bound: floor for the safe_gate branch (default -5.0)
return : [..., H, D]
"""
orig_shape = g.shape[:-1]