MCPcopy Create free account
hub / github.com/CompVis/diff2flow / __init__

Method __init__

diff2flow/models/unet/attention.py:91–115  ·  view source on GitHub ↗
(self, in_channels)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

NormalizeFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected