UpsamplingNearest2d

class dragon.vm.torch.nn.UpsamplingNearest2d(
  size=None,
  scale_factor=None
)[source]

Upsample input via nearest interpolating.

Examples:

x = torch.ones((1, 2, 3, 4))
y = torch.nn.UpsamplingNearest2d(size=6)(x)  # Shape: (1, 2, 6, 6)
z = torch.nn.UpsamplingNearest2d(scale_factor=2)(x)  # Shape: (1, 2, 6, 8)

__init__

UpsamplingNearest2d.__init__(
  size=None,
  scale_factor=None
)[source]

Create an UpsamplingNearest2d module.

Parameters:
  • size (Union[int, Sequence[int]], optional) – The output size.
  • scale_factor (Union[number, Sequence[number]], optional) – The scale factor along each input dimension.