Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/tvm/topi/nn/pooling.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ inline Tensor adaptive_pool_impl(const Tensor& x, const Array<PrimExpr>& output_

PrimExpr divide_factor = tvm::cast(x->dtype, 1);
for (size_t i = 0; i < n_dim; ++i) {
divide_factor *= tvm::cast(x->dtype, reduce_axes[i]->dom->extent);
divide_factor *= tvm::cast(DataType::Int(32), reduce_axes[i]->dom->extent);
}

return div(pool_sum(indices), divide_factor);
Expand Down
8 changes: 8 additions & 0 deletions tests/python/te/test_te_create_primfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,14 @@ def te_workload():
_check_workload(te_workload, tir_workload)


def test_global_pool():
# fix the issue-17938
data = te.placeholder((1, 1, 32, 32), dtype="int8", name="data")
op_output = topi.nn.global_pool(data=data, pool_type="avg", layout="NCHW")
f = te.create_prim_func([data, op_output])
assert f


def test_nested_reduce_domain_dependency():
@T.prim_func
def tir_workload(
Expand Down