Skip to content

Commit 27ae7e2

Browse files
committed
update note
1 parent 7bfd8ac commit 27ae7e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ngclearn/utils/model_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,12 @@ def softmax(x, tau=0.0):
590590
Returns:
591591
a (N x D) probability distribution output block
592592
"""
593+
# TODO: Do we need to also consider for edge case the division of tau by 0 is invalid?
593594
if tau > 0.0:
594595
x = x / tau
595596
max_x = jnp.max(x, axis=1, keepdims=True)
596597
exp_x = jnp.exp(x - max_x)
597-
return exp_x / jnp.sum(exp_x, axis=1, keepdims=True)
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
598599

599600
@jit
600601
def threshold_soft(x, lmbda):

0 commit comments

Comments
 (0)