Hi there,
I’d like to find the source code of “max_pool2d” and find that actually Pytorch uses aten::max_pool2d_with_indices() to perform the operation, which is under the directory of aten/src/ATen/native/Pooling.cpp. See the code below:
std::tuple<Tensor, Tensor> max_pool1d_with_indices(
const Tensor& self,
IntArrayRef kernel_size,
IntArrayRef stride,
IntArrayRef padding,
IntArrayRef dilation,
bool ceil_mode) {
if (stride.empty()) {
stride = kernel_size;
}
checkDim("max_pool1d", TensorArg(self, "self", 1), 3);
check1d("max_pool1d", "kernel_size", kernel_size);
check1d("max_pool1d", "stride", stride);
check1d("max_pool1d", "padding", padding);
check1d("max_pool1d", "dilation", dilation);
Tensor output, indices;
std::tie(output, indices) = at::max_pool2d_with_indices(
self.unsqueeze(2),
{1, kernel_size[0]},
{1, stride[0]},
{0, padding[0]},
{1, dilation[0]},
ceil_mode);
return std::make_tuple(output.squeeze(2), indices.squeeze(2));
}
However, it calls at::max_pool2d_with_indices() and where can I find this function specifically?
I know Pytorch uses Aten library for math computation but it seems that max_pool2d_with_indices() is the custom function using some basic maths.
Thanks!