sparsetrace commited on
Commit
f13bf61
·
verified ·
1 Parent(s): 3b9e9c7

Update PTST.py

Browse files
Files changed (1) hide show
  1. PTST.py +1 -1
PTST.py CHANGED
@@ -214,7 +214,7 @@ class MultiHeadSelfAttention(nn.Module):
214
  # S_{xx'} = sum_i R'_{ix} R'_{ix'}
215
  S = jnp.einsum("btx,bty->bxy", out, out) / jnp.maximum(T, 1) # (B,x,x)
216
  S2 = jnp.einsum("bii->bi", S)
217
- S = S2[None,:] + S2[:,None] - 2*S
218
  S = -1.*S
219
 
220
  # column-wise softmax (columns sum to 1): softmax over row axis
 
214
  # S_{xx'} = sum_i R'_{ix} R'_{ix'}
215
  S = jnp.einsum("btx,bty->bxy", out, out) / jnp.maximum(T, 1) # (B,x,x)
216
  S2 = jnp.einsum("bii->bi", S)
217
+ S = S2[:,None,:] + S2[:,:,None] - 2*S
218
  S = -1.*S
219
 
220
  # column-wise softmax (columns sum to 1): softmax over row axis