We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92633f9 commit 08b4d12Copy full SHA for 08b4d12
ngclearn/utils/model_utils.py
@@ -590,12 +590,11 @@ def softmax(x, tau=0.0):
590
Returns:
591
a (N x D) probability distribution output block
592
"""
593
- # TODO: Do we need to also consider for edge case the division of tau by 0 is invalid?
594
if tau > 0.0:
595
x = x / tau
596
max_x = jnp.max(x, axis=1, keepdims=True)
597
exp_x = jnp.exp(x - max_x)
598
- return exp_x / jnp.sum(exp_x, axis=1, keepdims=True) # TODO: We also have to take care of the case where the sum is 0
+ return exp_x / jnp.sum(exp_x, axis=1, keepdims=True)
599
600
@jit
601
def threshold_soft(x, lmbda):
0 commit comments