forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utils.cpp
35 lines (30 loc) · 812 Bytes
/
Utils.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <ATen/native/mkldnn/Utils.h>
#include <ATen/native/Pool.h>
#include <c10/util/irange.h>
namespace at { namespace native {
std::vector<int64_t> pool_output_sizes(
IntArrayRef input_size,
IntArrayRef kernel_size,
IntArrayRef stride,
IntArrayRef padding_l,
IntArrayRef padding_r,
IntArrayRef dilation,
bool ceil_mode) {
std::vector<int64_t> output_size(input_size.size());
// copy N and C
output_size[0] = input_size[0];
output_size[1] = input_size[1];
for (const auto i : c10::irange(2, input_size.size())) {
output_size[i] = pooling_output_shape_pad_lr<int64_t>(
input_size[i],
kernel_size[i - 2],
padding_l[i - 2],
padding_r[i - 2],
stride[i - 2],
dilation[i - 2],
ceil_mode
);
}
return output_size;
}
}}