diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/utils.py b/python/paddle/fluid/dygraph/dygraph_to_static/utils.py index 8c7cd67636614..41cd4676e608a 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/utils.py +++ b/python/paddle/fluid/dygraph/dygraph_to_static/utils.py @@ -610,7 +610,7 @@ def _inject_import_statements(): "import paddle", "from paddle import Tensor", "import paddle.fluid as fluid", "import paddle.jit.dy2static as _jst", "from typing import *", "import numpy as np", "import warnings", - "warnings.filterwarnings('ignore')" + "warnings.filterwarnings('ignore', category=DeprecationWarning)" ] return '\n'.join(import_statements) + '\n' diff --git a/python/paddle/fluid/layers/math_op_patch.py b/python/paddle/fluid/layers/math_op_patch.py index 62fd6b1e566f0..3721b97368af1 100644 --- a/python/paddle/fluid/layers/math_op_patch.py +++ b/python/paddle/fluid/layers/math_op_patch.py @@ -378,7 +378,8 @@ def __impl__(self, other_var): "If your code works well in the older versions but crashes in this version, try to use " "%s(X, Y, axis=0) instead of %s. This transitional warning will be dropped in the future." % (file_name, line_num, EXPRESSION_MAP[method_name], - op_type, op_type, EXPRESSION_MAP[method_name])) + op_type, op_type, EXPRESSION_MAP[method_name]), + category=DeprecationWarning) current_block(self).append_op(type=op_type, inputs={ 'X': [self],