From 2b53c68c114e63fb9fa4bc9cbdaf88abc37fe9b3 Mon Sep 17 00:00:00 2001 From: Linjie Chen <40840292+linjieccc@users.noreply.github.com> Date: Mon, 28 Mar 2022 14:23:45 +0800 Subject: [PATCH] Fix output dtype of elementwise_div (#40890) * fix outpu dtype of elementwise_div * fix ci * fix ci --- python/paddle/fluid/dygraph/math_op_patch.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/paddle/fluid/dygraph/math_op_patch.py b/python/paddle/fluid/dygraph/math_op_patch.py index ed3dac82e7..98de5949ba 100644 --- a/python/paddle/fluid/dygraph/math_op_patch.py +++ b/python/paddle/fluid/dygraph/math_op_patch.py @@ -264,6 +264,10 @@ def monkey_patch_math_varbase(): self = other_var other_var = tmp + if op_type == 'elementwise_div' and self.dtype in _supported_int_dtype_: + self = astype(self, 'float32') + other_var = astype(other_var, 'float32') + # 4. calculation axis = -1 math_op = getattr(_C_ops, op_type) -- GitLab