MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / forward

Method forward

monai/networks/blocks/downsample.py:294–307  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
310Downsample = DownSample

Callers

nothing calls this directly

Calls 1

pixelunshuffleFunction · 0.90

Tested by

no test coverage detected