mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-09 01:52:41 +00:00
Merge branch 'specaugmod_baseline' into randcombine1_expscale3_rework2c_maxabs1000_maxp0.95_noexp_convderiv3warmup_embed
This commit is contained in:
commit
2e6d170be8
@ -79,7 +79,7 @@ def get_diagnostics_for_dim(dim: int, tensors: List[Tensor],
|
|||||||
dim: the dimension to analyze, with 0 <= dim < tensors[0].ndim
|
dim: the dimension to analyze, with 0 <= dim < tensors[0].ndim
|
||||||
options: options object
|
options: options object
|
||||||
sizes_same: true if all the tensor sizes are the same on this dimension
|
sizes_same: true if all the tensor sizes are the same on this dimension
|
||||||
stats_type: either "abs" or "positive" or "eigs" or "value,
|
stats_type: either "abs" or "positive" or "eigs" or "value",
|
||||||
imdictates the type of stats
|
imdictates the type of stats
|
||||||
we accumulate, abs is mean absolute value, "positive"
|
we accumulate, abs is mean absolute value, "positive"
|
||||||
is proportion of positive to nonnegative values, "eigs"
|
is proportion of positive to nonnegative values, "eigs"
|
||||||
@ -129,12 +129,23 @@ def get_diagnostics_for_dim(dim: int, tensors: List[Tensor],
|
|||||||
percentiles.append(stats[index].item())
|
percentiles.append(stats[index].item())
|
||||||
percentiles = [ '%.2g' % x for x in percentiles ]
|
percentiles = [ '%.2g' % x for x in percentiles ]
|
||||||
percentiles = ' '.join(percentiles)
|
percentiles = ' '.join(percentiles)
|
||||||
return f'percentiles: [{percentiles}]'
|
ans = f'percentiles: [{percentiles}]'
|
||||||
else:
|
else:
|
||||||
stats = stats.tolist()
|
ans = stats.tolist()
|
||||||
stats = [ '%.2g' % x for x in stats ]
|
ans = [ '%.2g' % x for x in ans ]
|
||||||
stats = '[' + ' '.join(stats) + ']'
|
ans = '[' + ' '.join(ans) + ']'
|
||||||
return stats
|
if stats_type == "value":
|
||||||
|
norm = (stats ** 2).sum().sqrt().item()
|
||||||
|
mean_abs = stats.abs().mean().item()
|
||||||
|
# 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
|
||||||
|
# can be attributed to the mean of the distribution.
|
||||||
|
ans += f', norm={norm:.2g}, mean_abs={mean_abs:.2g}'
|
||||||
|
else:
|
||||||
|
mean = stats.mean().item()
|
||||||
|
ans += f', mean={mean:.2g}'
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user