MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / __init__

Method __init__

sat/sgm/modules/attention.py:119–124  ·  view source on GitHub ↗
(self, dim, heads=4, dim_head=32)

Source from the content-addressed store, hash-verified

117
118class LinearAttention(nn.Module):
119 def __init__(self, dim, heads=4, dim_head=32):
120 super().__init__()
121 self.heads = heads
122 hidden_dim = dim_head * heads
123 self.to_qkv = nn.Conv2d(dim, hidden_dim * 3, 1, bias=False)
124 self.to_out = nn.Conv2d(hidden_dim, dim, 1)
125
126 def forward(self, x):
127 b, c, h, w = x.shape

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected