Disable Hw Avg Pooling for small output tensors if excludePad=true (#772)

This commit is contained in:
Chance Luo 2020-06-06 00:47:53 +08:00 committed by GitHub
parent cad3ccd8a3
commit 7f09b54af8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,11 +117,12 @@ bool canTryHW(const ie::PoolingLayer::PoolType poolType,
}
// FIX #14949, enable HW AVG pooling, need SW postproc
if (excludePad && poolType == ie::PoolingLayer::PoolType::AVG) {
if (outputWidth == 5 &&
outputHeight == 5 &&
kernelSizeX == 5 &&
kernelSizeY == 5) {
// HW AVG pooling will output wrong results in borders when excludePad=true
bool hasPad = padLeft || padTop || padRight || padBottom;
if (excludePad && hasPad && poolType == ie::PoolingLayer::PoolType::AVG) {
// Only apply to small output tensors for now
// May need to loose the condition if accuracy issues are met
if (outputWidth <= 5 && outputHeight <= 5) {
tryHW = false;
}
}