Skip to content

Commit a10f101

Browse files
committed
update
1 parent 387a6a3 commit a10f101

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

onnxruntime/core/providers/cuda/nn/pool.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Status Pool<T, PoolType, NHWC>::ComputeInternal(OpKernelContext* context) const
179179
// The second dim of x_dims is channel(C).
180180
// Put the remaining part in kernel_shape
181181
kernel_shape.assign(x_dims.begin() + 2, x_dims.end());
182-
pads.assign(kernel_shape.size(), 0);
182+
pads.assign(kernel_shape.size() * 2, 0);
183183
strides.assign(kernel_shape.size(), 1);
184184
}
185185
}

onnxruntime/test/providers/cpu/nn/pool_op_test.cc

+13
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,19 @@ TEST(PoolTest, MaxPool1D_wrong_kernel_shape) {
202202
test.Run(OpTester::ExpectResult::kExpectFailure, "[ShapeInferenceError] Attribute kernel_shape has incorrect size", {kCudaNHWCExecutionProvider, kTensorrtExecutionProvider});
203203
}
204204

205+
TEST(PoolTest, MaxPool1D_global_pooling) {
206+
OpTester test("GlobalMaxPool");
207+
208+
std::vector<float> x_vals = {1, 2, 3, 4, 5, 6, 7, 8};
209+
std::vector<int64_t> x_dims = {1, 2, 4};
210+
std::vector<int64_t> expected_dims = {1, 2, 1};
211+
std::vector<float> expected_vals = {4, 8};
212+
213+
test.AddInput<float>("X", x_dims, x_vals);
214+
test.AddOutput<float>("Y", expected_dims, expected_vals);
215+
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kCudaNHWCExecutionProvider, kTensorrtExecutionProvider});
216+
}
217+
205218
TEST(PoolTest, MaxPool1D_case1) {
206219
OpTester test("MaxPool");
207220

0 commit comments

Comments
 (0)