mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-09 10:02:22 +00:00
Update utils.py
This commit is contained in:
parent
361f3b2061
commit
525caf624c
@ -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)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user