MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / forward

Method forward

diffusers/src/diffusers/models/upsampling.py:335–348  ·  view source on GitHub ↗
(self, inputs: torch.Tensor)

Source from the content-addressed store, hash-verified

333 self.register_buffer("kernel", kernel_1d.T @ kernel_1d, persistent=False)
334
335 def forward(self, inputs: torch.Tensor) -> torch.Tensor:
336 inputs = F.pad(inputs, ((self.pad + 1) // 2,) * 4, self.pad_mode)
337 weight = inputs.new_zeros(
338 [
339 inputs.shape[1],
340 inputs.shape[1],
341 self.kernel.shape[0],
342 self.kernel.shape[1],
343 ]
344 )
345 indices = torch.arange(inputs.shape[1], device=inputs.device)
346 kernel = self.kernel.to(weight)[None, :].expand(inputs.shape[1], -1, -1)
347 weight[indices, indices] = kernel
348 return F.conv_transpose2d(inputs, weight, stride=2, padding=self.pad * 2 + 1)
349
350
351class CogVideoXUpsample3D(nn.Module):

Callers

nothing calls this directly

Calls 2

padMethod · 0.80
toMethod · 0.45

Tested by

no test coverage detected