From 3d5d1173041a2569aaeb6224d79e36d420d39d46 Mon Sep 17 00:00:00 2001 From: HongyuJia Date: Tue, 20 Dec 2022 14:56:40 +0800 Subject: [PATCH] fix dtype error of add/sub/mul/div_with_axis (#49179) --- python/paddle/tensor/math.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index 7ab019d622..8f46da4d1d 100644 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -1022,11 +1022,6 @@ def _add_with_axis(x, y, axis=-1, name=None): x, y, axis=axis, act=act, op_name=op_type ) else: - if x.dtype != y.dtype: - raise TypeError( - 'Input tensors must be same type, but received type of x: %s, type of y: %s ' - % (x.dtype, y.dtype) - ) return _elementwise_op(LayerHelper(op_type, **locals())) @@ -1044,11 +1039,6 @@ def _subtract_with_axis(x, y, axis=-1, name=None): x, y, axis=axis, act=act, op_name=op_type ) else: - if x.dtype != y.dtype: - raise TypeError( - 'Input tensors must be same type, but received type of x: %s, type of y: %s ' - % (x.dtype, y.dtype) - ) return _elementwise_op(LayerHelper(op_type, **locals())) @@ -1066,11 +1056,6 @@ def _multiply_with_axis(x, y, axis=-1, name=None): x, y, axis=axis, act=act, op_name=op_type ) else: - if x.dtype != y.dtype: - raise TypeError( - 'Input tensors must be same type, but received type of x: %s, type of y: %s ' - % (x.dtype, y.dtype) - ) return _elementwise_op(LayerHelper(op_type, **locals())) @@ -1086,11 +1071,6 @@ def _divide_with_axis(x, y, axis=-1, name=None): x, y, axis=axis, act=act, op_name=op_type ) else: - if x.dtype != y.dtype: - raise TypeError( - 'Input tensors must be same type, but received type of x: %s, type of y: %s ' - % (x.dtype, y.dtype) - ) return _elementwise_op(LayerHelper(op_type, **locals())) -- GitLab