Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
af0a1475
Commit
af0a1475
authored
Mar 06, 2026
by
PanZezhong
Browse files
issue/1031 fix T1-1-9 compile
parent
2904ec00
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
src/infiniop/ops/adaptive_max_pool1d/cpu/adaptive_max_pool1d_cpu.cc
...op/ops/adaptive_max_pool1d/cpu/adaptive_max_pool1d_cpu.cc
+6
-10
No files found.
src/infiniop/ops/adaptive_max_pool1d/cpu/adaptive_max_pool1d_cpu.cc
View file @
af0a1475
...
@@ -52,16 +52,12 @@ infiniStatus_t adaptiveMaxPool1d(const AdaptiveMaxPool1dInfo *info, T *y, const
...
@@ -52,16 +52,12 @@ infiniStatus_t adaptiveMaxPool1d(const AdaptiveMaxPool1dInfo *info, T *y, const
}
}
for
(
size_t
out_idx
=
0
;
out_idx
<
output_length
;
++
out_idx
)
{
for
(
size_t
out_idx
=
0
;
out_idx
<
output_length
;
++
out_idx
)
{
// 计算池化窗口范围 [start_index, end_index)
size_t
start_index
=
(
out_idx
*
input_length
)
/
output_length
;
// 公式参考 PyTorch:
size_t
end_index
=
((
out_idx
+
1
)
*
input_length
+
output_length
-
1
)
/
output_length
;
// start = floor(out_idx * L_in / L_out)
// end = ceil((out_idx + 1) * L_in / L_out)
start_index
=
std
::
max
(
start_index
,
size_t
(
0
));
int
start_index
=
std
::
floor
((
float
)
out_idx
*
input_length
/
output_length
);
end_index
=
std
::
min
(
end_index
,
input_length
);
int
end_index
=
std
::
ceil
((
float
)(
out_idx
+
1
)
*
input_length
/
output_length
);
size_t
window_len
=
end_index
-
start_index
;
start_index
=
std
::
max
(
start_index
,
0
);
end_index
=
std
::
min
(
end_index
,
(
int
)
input_length
);
int
window_len
=
end_index
-
start_index
;
if
(
window_len
<=
0
)
{
if
(
window_len
<=
0
)
{
continue
;
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment