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

Method forward

sat/sgm/modules/autoencoding/vqvae/movq_modules.py:141–161  ·  view source on GitHub ↗
(self, x, temb, zq)

Source from the content-addressed store, hash-verified

139 self.nin_shortcut = torch.nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=1, padding=0)
140
141 def forward(self, x, temb, zq):
142 h = x
143 h = self.norm1(h, zq)
144 h = nonlinearity(h)
145 h = self.conv1(h)
146
147 if temb is not None:
148 h = h + self.temb_proj(nonlinearity(temb))[:, :, None, None]
149
150 h = self.norm2(h, zq)
151 h = nonlinearity(h)
152 h = self.dropout(h)
153 h = self.conv2(h)
154
155 if self.in_channels != self.out_channels:
156 if self.use_conv_shortcut:
157 x = self.conv_shortcut(x)
158 else:
159 x = self.nin_shortcut(x)
160
161 return x + h
162
163
164class AttnBlock(nn.Module):

Callers

nothing calls this directly

Calls 1

nonlinearityFunction · 0.70

Tested by

no test coverage detected