From ea8aa4320ecf8a486372f7f9119d2428114f610e Mon Sep 17 00:00:00 2001 From: hwa Date: Wed, 5 Apr 2023 13:04:13 +0800 Subject: [PATCH] [CodeStyle][PLR0206] Cannot have defined parameters for properties (#52539) --- pyproject.toml | 2 +- test/dygraph_to_static/simnet_dygraph_model.py | 11 ----------- test/dygraph_to_static/simnet_dygraph_model_v2.py | 11 ----------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8d847e53bd4..8c27dfbe332 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,7 +96,7 @@ select = [ # "PLE2514", # "PLE2515", # "PLR0133", - # "PLR0206", + "PLR0206", "PLR0402", # "PLR0911", # "PLR0912", diff --git a/test/dygraph_to_static/simnet_dygraph_model.py b/test/dygraph_to_static/simnet_dygraph_model.py index c2bf12bc970..341785a9d6a 100644 --- a/test/dygraph_to_static/simnet_dygraph_model.py +++ b/test/dygraph_to_static/simnet_dygraph_model.py @@ -16,7 +16,6 @@ from functools import reduce import paddle import paddle.fluid.param_attr as attr -from paddle.common_ops_import import Variable from paddle.jit.api import to_static from paddle.nn import Layer @@ -363,16 +362,6 @@ class FC(Layer): attr=self._bias_attr, shape=size, dtype=self._dtype, is_bias=True ) - # TODO(songyouwei): We should remove _w property - @property - def _w(self, i=0): - return self.__w[i] - - @_w.setter - def _w(self, value, i=0): - assert isinstance(self.__w[i], Variable) - self.__w[i].set_value(value) - @property def weight(self): if len(self.__w) > 1: diff --git a/test/dygraph_to_static/simnet_dygraph_model_v2.py b/test/dygraph_to_static/simnet_dygraph_model_v2.py index 55b95638e3c..e843f6b82e8 100644 --- a/test/dygraph_to_static/simnet_dygraph_model_v2.py +++ b/test/dygraph_to_static/simnet_dygraph_model_v2.py @@ -15,7 +15,6 @@ from functools import reduce import paddle -from paddle.common_ops_import import Variable class EmbeddingLayer: @@ -349,16 +348,6 @@ class FC(paddle.nn.Layer): attr=self._bias_attr, shape=size, dtype=self._dtype, is_bias=True ) - # TODO(songyouwei): We should remove _w property - @property - def _w(self, i=0): - return self.__w[i] - - @_w.setter - def _w(self, value, i=0): - assert isinstance(self.__w[i], Variable) - self.__w[i].set_value(value) - @property def weight(self): if len(self.__w) > 1: -- GitLab