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

Method forward

diffusers/src/diffusers/models/downsampling.py:272–285  ·  view source on GitHub ↗
(self, inputs: torch.Tensor)

Source from the content-addressed store, hash-verified

270 self.register_buffer("kernel", kernel_1d.T @ kernel_1d, persistent=False)
271
272 def forward(self, inputs: torch.Tensor) -> torch.Tensor:
273 inputs = F.pad(inputs, (self.pad,) * 4, self.pad_mode)
274 weight = inputs.new_zeros(
275 [
276 inputs.shape[1],
277 inputs.shape[1],
278 self.kernel.shape[0],
279 self.kernel.shape[1],
280 ]
281 )
282 indices = torch.arange(inputs.shape[1], device=inputs.device)
283 kernel = self.kernel.to(weight)[None, :].expand(inputs.shape[1], -1, -1)
284 weight[indices, indices] = kernel
285 return F.conv2d(inputs, weight, stride=2)
286
287
288class CogVideoXDownsample3D(nn.Module):

Callers

nothing calls this directly

Calls 2

padMethod · 0.80
toMethod · 0.45

Tested by

no test coverage detected