Some cosmetic improvements

This commit is contained in:
Daniel Povey 2022-09-27 11:08:44 +08:00
parent 71b3756ada
commit 76e66408c5
2 changed files with 2 additions and 2 deletions

View File

@ -179,7 +179,7 @@ class MaxEigLimiterFunction(torch.autograd.Function):
ans_direction = ans_direction / ans_direction.norm()
if random.random() < 0.001:
logging.info(f"variance_proportion = {variance_proportion.item()}")
logging.info(f"variance_proportion = {variance_proportion.item()}, shape={tuple(x.shape)}")
# Caution: this causes a CUDA sync, which is not ideal.
if variance_proportion >= max_variance_proportion:

View File

@ -240,7 +240,7 @@ class TensorDiagnostic(object):
ans = stats.tolist()
ans = ["%.2g" % x for x in ans]
ans = "[" + " ".join(ans) + "]"
if stats_type == "value":
if stats_type in [ "value", "rms", "eigs" ]:
# This norm is useful because it is strictly less than the largest
# sqrt(eigenvalue) of the variance, which we print out, and shows,
# speaking in an approximate way, how much of that largest eigenvalue