Merge pull request #483 from yaozengwei/fix_diagnostic

Fix diagnostic
This commit is contained in:
Daniel Povey 2022-07-18 23:33:45 -07:00 committed by GitHub
commit a8696b36fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,6 +178,9 @@ class TensorDiagnostic(object):
def print_diagnostics(self): def print_diagnostics(self):
"""Print diagnostics for each dimension of the tensor.""" """Print diagnostics for each dimension of the tensor."""
if self.stats is None:
print(f"Warning: the stats of {self.name} is None.")
return
for dim, this_dim_stats in enumerate(self.stats): for dim, this_dim_stats in enumerate(self.stats):
for stats_type, stats_list in this_dim_stats.items(): for stats_type, stats_list in this_dim_stats.items():
# stats_type could be "rms", "value", "abs", "eigs", "positive". # stats_type could be "rms", "value", "abs", "eigs", "positive".