MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / __init__

Method __init__

ldm/modules/attention.py:93–117  ·  view source on GitHub ↗
(self, in_channels)

Source from the content-addressed store, hash-verified

91
92class SpatialSelfAttention(nn.Module):
93 def __init__(self, in_channels):
94 super().__init__()
95 self.in_channels = in_channels
96
97 self.norm = Normalize(in_channels)
98 self.q = torch.nn.Conv2d(in_channels,
99 in_channels,
100 kernel_size=1,
101 stride=1,
102 padding=0)
103 self.k = torch.nn.Conv2d(in_channels,
104 in_channels,
105 kernel_size=1,
106 stride=1,
107 padding=0)
108 self.v = torch.nn.Conv2d(in_channels,
109 in_channels,
110 kernel_size=1,
111 stride=1,
112 padding=0)
113 self.proj_out = torch.nn.Conv2d(in_channels,
114 in_channels,
115 kernel_size=1,
116 stride=1,
117 padding=0)
118
119 def forward(self, x):
120 h_ = x

Callers

nothing calls this directly

Calls 2

NormalizeFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected