From 63f1e6bdc4be0d037cbea55c39ba7afae115174a Mon Sep 17 00:00:00 2001 From: Jiabin Yang Date: Tue, 26 Oct 2021 20:21:00 +0800 Subject: [PATCH] Remove additional warnning in layer.to (#36700) * remove additional warnning in layer.to * remove additional warnning in layer.to * remove additional warnning in layer.to * remove additional warnning in layer.to * remove additional warnning in layer.to --- python/paddle/fluid/dygraph/layers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/dygraph/layers.py b/python/paddle/fluid/dygraph/layers.py index 694f9dc25e8..e1855ee6db9 100644 --- a/python/paddle/fluid/dygraph/layers.py +++ b/python/paddle/fluid/dygraph/layers.py @@ -1590,7 +1590,10 @@ class Layer(core.Layer): return new_t - self._apply(transform, device, dtype, blocking) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=UserWarning) + self._apply(transform, device, dtype, blocking) + self._dtype = dtype # [aliases] Compatible with old method names -- GitLab