Update utils.py

This commit is contained in:
zr_jin 2025-01-27 16:05:11 +08:00 committed by GitHub
parent 361f3b2061
commit 525caf624c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,7 @@ def default(v, d):
def lens_to_mask( def lens_to_mask(
t: int["b"], length: int | None = None # noqa: F722 F821 t: int["b"], length: int | None = None # noqa: F722 F821
) -> bool["b n"]: ) -> bool["b n"]: # noqa: F722 F821
if not exists(length): if not exists(length):
length = t.amax() length = t.amax()
@ -72,7 +72,7 @@ def mask_from_frac_lengths(
def maybe_masked_mean( def maybe_masked_mean(
t: float["b n d"], mask: bool["b n"] = None # noqa: F722 F821 t: float["b n d"], mask: bool["b n"] = None # noqa: F722 F821
) -> float["b d"]: ) -> float["b d"]: # noqa: F722 F821
if not exists(mask): if not exists(mask):
return t.mean(dim=1) return t.mean(dim=1)