Skip to content

Commit dd859cc

Browse files
issue/1031 fix T1-1-9 compile
1 parent 2904ec0 commit dd859cc

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/infiniop/ops/adaptive_max_pool1d/cpu/adaptive_max_pool1d_cpu.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,8 @@ infiniStatus_t adaptiveMaxPool1d(const AdaptiveMaxPool1dInfo *info, T *y, const
5252
}
5353

5454
for (size_t out_idx = 0; out_idx < output_length; ++out_idx) {
55-
// 计算池化窗口范围 [start_index, end_index)
56-
// 公式参考 PyTorch:
57-
// start = floor(out_idx * L_in / L_out)
58-
// end = ceil((out_idx + 1) * L_in / L_out)
59-
int start_index = std::floor((float)out_idx * input_length / output_length);
60-
int end_index = std::ceil((float)(out_idx + 1) * input_length / output_length);
55+
int start_index = (out_idx * input_length) / output_length;
56+
int end_index = ((out_idx + 1) * input_length + output_length - 1) / output_length;
6157

6258
start_index = std::max(start_index, 0);
6359
end_index = std::min(end_index, (int)input_length);

0 commit comments

Comments
 (0)