AdaptiveAvgPool2d.patch 1.1 KB

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