MCPcopy
hub / github.com/Vchitect/Latte / std

Method std

tools/torch_utils/training_stats.py:198–210  ·  view source on GitHub ↗

r"""Returns the standard deviation of the scalars that were accumulated for the given statistic between the last two calls to `update()`, or NaN if no scalars were collected.

(self, name)

Source from the content-addressed store, hash-verified

196 return float(delta[1] / delta[0])
197
198 def std(self, name):
199 r"""Returns the standard deviation of the scalars that were
200 accumulated for the given statistic between the last two calls to
201 `update()`, or NaN if no scalars were collected.
202 """
203 delta = self._get_delta(name)
204 if int(delta[0]) == 0 or not np.isfinite(float(delta[1])):
205 return float('nan')
206 if int(delta[0]) == 1:
207 return float(0)
208 mean = float(delta[1] / delta[0])
209 raw_var = float(delta[2] / delta[0])
210 return np.sqrt(max(raw_var - np.square(mean), 0))
211
212 def as_dict(self):
213 r"""Returns the averages accumulated between the last two calls to

Callers 5

as_dictMethod · 0.95
forwardMethod · 0.80
calc_metricFunction · 0.80
compute_isFunction · 0.80
compute_isvFunction · 0.80

Calls 1

_get_deltaMethod · 0.95

Tested by

no test coverage detected