MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / low_version_attention

Function low_version_attention

diffsynth/models/attention.py:5–12  ·  view source on GitHub ↗
(query, key, value, attn_bias=None)

Source from the content-addressed store, hash-verified

3
4
5def low_version_attention(query, key, value, attn_bias=None):
6 scale = 1 / query.shape[-1] ** 0.5
7 query = query * scale
8 attn = torch.matmul(query, key.transpose(-2, -1))
9 if attn_bias is not None:
10 attn = attn + attn_bias
11 attn = attn.softmax(-1)
12 return attn @ value
13
14
15class Attention(torch.nn.Module):

Callers 1

xformers_forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected