MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / forward

Method forward

k_diffusion/layers.py:396–401  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

394 self.register_buffer('kernel', kernel_1d.T @ kernel_1d)
395
396 def forward(self, x):
397 x = F.pad(x, (self.pad,) * 4, self.pad_mode)
398 weight = x.new_zeros([x.shape[1], x.shape[1], self.kernel.shape[0], self.kernel.shape[1]])
399 indices = torch.arange(x.shape[1], device=x.device)
400 weight[indices, indices] = self.kernel.to(weight)
401 return F.conv2d(x, weight, stride=2)
402
403
404class Upsample2d(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected