Args: x: Tensor in shape (batch, channel, spatial_1[, spatial_2, ...). Returns: Tensor with reduced spatial dimensions and increased channel depth.
(self, x: torch.Tensor)
| 292 | self.conv_block = conv_block |
| 293 | |
| 294 | def forward(self, x: torch.Tensor) -> torch.Tensor: |
| 295 | """ |
| 296 | Args: |
| 297 | x: Tensor in shape (batch, channel, spatial_1[, spatial_2, ...). |
| 298 | Returns: |
| 299 | Tensor with reduced spatial dimensions and increased channel depth. |
| 300 | """ |
| 301 | x = self.conv_block(x) |
| 302 | if not all(d % self.scale_factor == 0 for d in x.shape[2:]): |
| 303 | raise ValueError( |
| 304 | f"All spatial dimensions {x.shape[2:]} must be evenly " f"divisible by scale_factor {self.scale_factor}" |
| 305 | ) |
| 306 | x = pixelunshuffle(x, self.dimensions, self.scale_factor) |
| 307 | return x |
| 308 | |
| 309 | |
| 310 | Downsample = DownSample |
nothing calls this directly
no test coverage detected