MCPcopy Create free account
hub / github.com/TorchSSL/TorchSSL / entropy_loss

Function entropy_loss

models/vat/vat_utils.py:17–19  ·  view source on GitHub ↗
(ul_y)

Source from the content-addressed store, hash-verified

15 return self.value
16
17def entropy_loss(ul_y):
18 p = F.softmax(ul_y, dim=1)
19 return -(p*F.log_softmax(ul_y, dim=1)).sum(dim=1).mean(dim=0)
20
21def _l2_normalize(d):
22

Callers 1

trainMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected