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

Method forward

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

Source from the content-addressed store, hash-verified

410 self.register_buffer('kernel', kernel_1d.T @ kernel_1d)
411
412 def forward(self, x):
413 x = F.pad(x, ((self.pad + 1) // 2,) * 4, self.pad_mode)
414 weight = x.new_zeros([x.shape[1], x.shape[1], self.kernel.shape[0], self.kernel.shape[1]])
415 indices = torch.arange(x.shape[1], device=x.device)
416 weight[indices, indices] = self.kernel.to(weight)
417 return F.conv_transpose2d(x, weight, stride=2, padding=self.pad * 2 + 1)
418
419
420# Embeddings

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected