Also fix index_sv_ratio

This commit is contained in:
woctordho
2026-03-29 18:56:26 +08:00
parent 41de9362a6
commit 9cb692f12a

View File

@@ -78,7 +78,7 @@ def index_sv_fro(S, target):
def index_sv_ratio(S, target):
max_sv = S[0]
min_sv = max_sv / target
index = int(torch.sum(S > min_sv).item())
index = int(torch.sum(S > min_sv).item()) - 1
index = max(0, min(index, len(S) - 1))
return index