From 46797f53de8e24d718aa1cccdd38b0183be469b1 Mon Sep 17 00:00:00 2001 From: danleifeng <52735331+danleifeng@users.noreply.github.com> Date: Tue, 15 Oct 2019 10:18:58 +0800 Subject: [PATCH] fix small bug of error message for elementwise_add and elementwise_mul (#20619) * fix error message for elementwise_add/mul;test=develop * fix type error message;test=develop --- python/paddle/fluid/layers/nn.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 57a22116cda..3322519fcda 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -13772,24 +13772,24 @@ def _elementwise_op(helper): (op_type, type(y))) if convert_dtype(x.dtype) in ['float16']: warnings.warn( - "The data type of 'x' in batch_norm only support float16 on GPU now." - ) + "The data type of 'x' in %s only support float16 on GPU now." % + (op_type)) if convert_dtype(y.dtype) in ['float16']: warnings.warn( - "The data type of 'y' in batch_norm only support float16 on GPU now." - ) + "The data type of 'y' in %s only support float16 on GPU now." % + (op_type)) if convert_dtype(x.dtype) not in [ 'float16', 'float32', 'float64', 'int32', 'int64' ]: raise TypeError( - "The data type of 'x' in batch_norm must be float16 or float32 or float64 or int32 or int64, but received %s." - % (convert_dtype(x.dtype))) + "The data type of 'x' in %s must be float16 or float32 or float64 or int32 or int64, " + "but received %s." % (op_type, convert_dtype(x.dtype))) if convert_dtype(y.dtype) not in [ 'float16', 'float32', 'float64', 'int32', 'int64' ]: raise TypeError( - "The data type of 'y' in batch_norm must be float16 or float32 or float64 or int32 or int64, but received %s." - % (convert_dtype(y.dtype))) + "The data type of 'y' in %s must be float16 or float32 or float64 or int32 or int64, " + "but received %s." % (op_type, convert_dtype(y.dtype))) axis = helper.kwargs.get('axis', -1) use_mkldnn = helper.kwargs.get('use_mkldnn', False) -- GitLab