From 576d0d938bf14eb6434754e7260f96ff301a3d2b Mon Sep 17 00:00:00 2001 From: huangxu96 <46740794+huangxu96@users.noreply.github.com> Date: Wed, 9 Dec 2020 15:53:37 +0800 Subject: [PATCH] add fp16 check into max and avg pool (#29479) --- python/paddle/nn/functional/pooling.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/paddle/nn/functional/pooling.py b/python/paddle/nn/functional/pooling.py index 1c3a035bbc..50096f89d9 100755 --- a/python/paddle/nn/functional/pooling.py +++ b/python/paddle/nn/functional/pooling.py @@ -674,7 +674,8 @@ def max_pool2d(x, return_mask=True) # out.shape [1, 3, 16, 16], max_indices.shape [1, 3, 16, 16], """ - check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'max_pool2d') + check_variable_and_dtype(x, 'x', ['float16', 'float32', 'float64'], + 'max_pool2d') kernel_size = utils.convert_to_list(kernel_size, 2, 'pool_size') if stride is None: stride = kernel_size @@ -911,7 +912,8 @@ def adaptive_avg_pool1d(x, output_size, name=None): # pool_out shape: [1, 3, 16]) """ pool_type = 'avg' - check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'adaptive_pool2d') + check_variable_and_dtype(x, 'x', ['float16', 'float32', 'float64'], + 'adaptive_pool2d') _check_input(x, 3) check_type(output_size, 'pool_size', (int), 'adaptive_pool1d') -- GitLab