MCPcopy
hub / github.com/SizheAn/PanoHead / std

Method std

torch_utils/training_stats.py:200–212  ·  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

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

Callers 6

as_dictMethod · 0.95
compute_isFunction · 0.80
_get_raw_labelsMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80

Calls 1

_get_deltaMethod · 0.95

Tested by

no test coverage detected