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

Function safelog

imperative/python/test/unit/functional/test_loss.py:129–131  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

127
128def _ctc_npy_single_seq(pred, label, blank):
129 def safelog(x):
130 eps = np.finfo(x.dtype).tiny
131 return np.log(np.maximum(x, eps))
132
133 def log_sum_exp(x, y):
134 x, y = np.maximum(x, y), np.minimum(x, y)

Callers 1

_ctc_npy_single_seqFunction · 0.85

Calls 1

logMethod · 0.45

Tested by

no test coverage detected