MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / forward

Method forward

diffsynth/models/stepvideo_vae.py:178–195  ·  view source on GitHub ↗
(self, x, output_size=None)

Source from the content-addressed store, hash-verified

176 self.conv = nn.ConvTranspose2d(channels, self.out_channels, 4, 2, 1)
177
178 def forward(self, x, output_size=None):
179 assert x.shape[-1] == self.channels
180
181 if self.use_conv_transpose:
182 return self.conv(x)
183
184 if output_size is None:
185 x = F.interpolate(
186 x.permute(0,3,1,2).to(memory_format=torch.channels_last),
187 scale_factor=2.0, mode='nearest').permute(0,2,3,1).contiguous()
188 else:
189 x = F.interpolate(
190 x.permute(0,3,1,2).to(memory_format=torch.channels_last),
191 size=output_size, mode='nearest').permute(0,2,3,1).contiguous()
192
193 # x = self.conv(x)
194 x = base_conv2d(x, self.conv, channel_last=True)
195 return x
196
197
198class Downsample2D(nn.Module):

Callers

nothing calls this directly

Calls 3

base_conv2dFunction · 0.85
interpolateMethod · 0.80
toMethod · 0.45

Tested by

no test coverage detected