--- /usr/local/lib/python3.5/dist-packages/torch/nn/modules/pooling.py +++ /usr/local/lib/python3.5/dist-packages/torch/nn/modules/pooling.py @@ -6,7 +6,7 @@ Args: output_size: the target output size of the image of the form H x W. - Can be a tuple (H, W) or a single H for a square image H x H. + Can be a tuple (H, W) or a single H for a square image H x H H and W can be either a ``int``, or ``None`` which means the size will be the same as that of the input. @@ -20,14 +20,13 @@ >>> input = torch.randn(1, 64, 10, 9) >>> output = m(input) >>> # target output size of 10x7 - >>> m = nn.AdaptiveAvgPool2d((None, 7)) + >>> m = nn.AdaptiveMaxPool2d((None, 7)) >>> input = torch.randn(1, 64, 10, 9) >>> output = m(input) """ - output_size: _size_2_opt_t - - def forward(self, input: Tensor) -> Tensor: + @weak_script_method + def forward(self, input): return F.adaptive_avg_pool2d(input, self.output_size)