diff --git a/paconvert/api_mapping.json b/paconvert/api_mapping.json index a9be417f8..6cf219935 100644 --- a/paconvert/api_mapping.json +++ b/paconvert/api_mapping.json @@ -6674,7 +6674,7 @@ "Matcher": "TensorUnchangeMatcher" }, "torch.nn.Module.bfloat16": { - "Matcher": "NnModuleTypeMatcher", + "Matcher": "GenericMatcher", "paddle_api": "paddle.nn.Layer.to" }, "torch.nn.Module.buffers": { @@ -6694,14 +6694,14 @@ "torch.nn.Module.cpu": {}, "torch.nn.Module.cuda": {}, "torch.nn.Module.double": { - "Matcher": "NnModuleTypeMatcher", + "Matcher": "GenericMatcher", "paddle_api": "paddle.nn.Layer.to" }, "torch.nn.Module.eval": { "Matcher": "TensorUnchangeMatcher" }, "torch.nn.Module.float": { - "Matcher": "NnModuleTypeMatcher", + "Matcher": "GenericMatcher", "paddle_api": "paddle.nn.Layer.to" }, "torch.nn.Module.get_buffer": {}, @@ -6709,7 +6709,7 @@ "torch.nn.Module.get_parameter": {}, "torch.nn.Module.get_submodule": {}, "torch.nn.Module.half": { - "Matcher": "NnModuleTypeMatcher", + "Matcher": "GenericMatcher", "paddle_api": "paddle.nn.Layer.to" }, "torch.nn.Module.ipu": {}, @@ -6867,7 +6867,7 @@ "paddle_api": "paddle.nn.Layer.train" }, "torch.nn.Module.type": { - "Matcher": "NnModuleTypeMatcher", + "Matcher": "GenericMatcher", "paddle_api": "paddle.nn.Layer.to" }, "torch.nn.Module.xpu": {}, diff --git a/paconvert/api_matcher.py b/paconvert/api_matcher.py index e09f230de..a7ec1bac8 100644 --- a/paconvert/api_matcher.py +++ b/paconvert/api_matcher.py @@ -3651,15 +3651,6 @@ def get_paddle_nodes(self, args, kwargs): return node -class NnModuleToMatcher(BaseMatcher): - def generate_code(self, kwargs): - kwargs = self.parse_kwargs(kwargs) - if "non_blocking" in kwargs: - kwargs["blocking"] = not kwargs["non_blocking"] - del kwargs["non_blocking"] - return GenericMatcher.generate_code(self, kwargs) - - class SizeAverageMatcher(BaseMatcher): def generate_code(self, kwargs): process_reduce_and_size_average(kwargs)