MCPcopy Create free account
hub / github.com/PrathamLearnsToCode/paper2code / Downsample

Class Downsample

skills/paper2code/worked/ddpm/src/model.py:192–200  ·  view source on GitHub ↗

Spatial downsampling by factor 2. [FROM_OFFICIAL_CODE]

Source from the content-addressed store, hash-verified

190
191
192class Downsample(nn.Module):
193 """Spatial downsampling by factor 2. [FROM_OFFICIAL_CODE]"""
194
195 def __init__(self, channels: int):
196 super().__init__()
197 self.conv = nn.Conv2d(channels, channels, kernel_size=3, stride=2, padding=1)
198
199 def forward(self, x: torch.Tensor) -> torch.Tensor:
200 return self.conv(x) # (batch, C, H, W) -> (batch, C, H/2, W/2)
201
202
203class Upsample(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected