MaxPool2d.patch 1.3 KB

12345678910111213141516171819202122232425262728
  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. @@ -16,10 +16,6 @@
  4. If :attr:`padding` is non-zero, then the input is implicitly zero-padded on both sides
  5. for :attr:`padding` number of points. :attr:`dilation` controls the spacing between the kernel points.
  6. It is harder to describe, but this `link`_ has a nice visualization of what :attr:`dilation` does.
  7. -
  8. - Note:
  9. - When ceil_mode=True, sliding windows are allowed to go off-bounds if they start within the left padding
  10. - or the input. Sliding windows that would start in the right padded region are ignored.
  11. The parameters :attr:`kernel_size`, :attr:`stride`, :attr:`padding`, :attr:`dilation` can either be:
  12. @@ -61,12 +57,8 @@
  13. https://github.com/vdumoulin/conv_arithmetic/blob/master/README.md
  14. """
  15. - kernel_size: _size_2_t
  16. - stride: _size_2_t
  17. - padding: _size_2_t
  18. - dilation: _size_2_t
  19. -
  20. - def forward(self, input: Tensor) -> Tensor:
  21. + @weak_script_method
  22. + def forward(self, input):
  23. return F.max_pool2d(input, self.kernel_size, self.stride,
  24. self.padding, self.dilation, self.ceil_mode,
  25. self.return_indices)