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

Method __init__

sat/sgm/modules/diffusionmodules/model.py:145–153  ·  view source on GitHub ↗
(self, in_channels)

Source from the content-addressed store, hash-verified

143
144class AttnBlock(nn.Module):
145 def __init__(self, in_channels):
146 super().__init__()
147 self.in_channels = in_channels
148
149 self.norm = Normalize(in_channels)
150 self.q = torch.nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0)
151 self.k = torch.nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0)
152 self.v = torch.nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0)
153 self.proj_out = torch.nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0)
154
155 def attention(self, h_: torch.Tensor) -> torch.Tensor:
156 h_ = self.norm(h_)

Callers

nothing calls this directly

Calls 2

NormalizeFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected