MCPcopy Create free account
hub / github.com/Notgnoshi/generative / softmax

Function softmax

tools/random-production-rules.py:193–197  ·  view source on GitHub ↗
(distribution, temperature)

Source from the content-addressed store, hash-verified

191
192
193def softmax(distribution, temperature):
194 denom = sum(np.exp(np.array(list(distribution.values())) / temperature))
195 for token in distribution:
196 distribution[token] = np.exp(distribution[token] / temperature) / denom
197 return distribution
198
199
200def normalize(distribution):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected