MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_param_stats

Function get_param_stats

imperative/python/megengine/utils/module_stats.py:299–312  ·  view source on GitHub ↗
(param: Tensor)

Source from the content-addressed store, hash-verified

297
298
299def get_param_stats(param: Tensor):
300 nbits = get_dtype_bit(np.dtype(param.dtype).name)
301 shape = param.shape
302 param_dim = np.prod(param.shape)
303 param_size = param_dim * nbits // 8
304 return {
305 "dtype": np.dtype(param.dtype),
306 "shape": shape,
307 "mean": "{:.3g}".format(_mean(param)),
308 "std": "{:.3g}".format(_std(param)),
309 "param_dim": param_dim,
310 "nbits": nbits,
311 "size": param_size,
312 }
313
314
315def sum_param_stats(params, bar_length_max=20):

Callers 3

visualizeFunction · 0.90
module_stats_hookFunction · 0.85
param_access_recordFunction · 0.85

Calls 6

get_dtype_bitFunction · 0.85
_meanFunction · 0.85
_stdFunction · 0.85
dtypeMethod · 0.45
prodMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected