Update PTST.py
Browse files
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
|