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

Class DownSampler

diffsynth/models/sd_unet.py:70–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69
70class DownSampler(torch.nn.Module):
71 def __init__(self, channels, padding=1, extra_padding=False):
72 super().__init__()
73 self.conv = torch.nn.Conv2d(channels, channels, 3, stride=2, padding=padding)
74 self.extra_padding = extra_padding
75
76 def forward(self, hidden_states, time_emb, text_emb, res_stack, **kwargs):
77 if self.extra_padding:
78 hidden_states = torch.nn.functional.pad(hidden_states, (0, 1, 0, 1), mode="constant", value=0)
79 hidden_states = self.conv(hidden_states)
80 return hidden_states, time_emb, text_emb, res_stack
81
82
83class UpSampler(torch.nn.Module):

Callers 7

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected