Update cross_entropy_loss.py
This commit is contained in:
parent
6ef574b58a
commit
895a5364f0
1 changed files with 1 additions and 0 deletions
|
|
@ -232,6 +232,7 @@ def _cross_entropy_backward(
|
|||
pass
|
||||
|
||||
# Do logit softcapping for Gemma 2: t * tanh(1/t * x)
|
||||
partial = 0.0
|
||||
if DO_SOFTCAPPING:
|
||||
# d/dx [t * tanh(1/t * x)] = 1 - tanh^2(1/t * x)
|
||||
partial = triton_tanh(x / SOFTCAP)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue