diff --git a/python/paddle/fluid/dygraph/math_op_patch.py b/python/paddle/fluid/dygraph/math_op_patch.py index ed3dac82e78c49133fe7cf3239c359ab2966aa9b..98de5949ba422618c48dd4fba8b42b8686ea9c85 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)