MCPcopy Create free account
hub / github.com/Standard-Intelligence/hertz-dev / loss

Method loss

ioblocks.py:55–64  ·  view source on GitHub ↗
(self, data, dataHat)

Source from the content-addressed store, hash-verified

53 return (locs, scales, weights)
54
55 def loss(self, data, dataHat):
56 locs, scales, weights = dataHat
57 log_probs = -0.5 * T.sum(
58 (data.unsqueeze(-2) - locs).pow(2) / scales.pow(2) +
59 2 * T.log(scales) +
60 T.log(T.tensor(2 * T.pi)),
61 dim=-1
62 )
63 log_weights = F.log_softmax(weights, dim=-1)
64 return -T.logsumexp(log_weights + log_probs, dim=-1)
65
66
67 def temp_sample(self, orig_pdist, temp):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected