From cd46c6aa341fe492096488b6c7a60d0ef03fb68b Mon Sep 17 00:00:00 2001 From: Channingss Date: Tue, 19 Jan 2021 06:22:17 +0000 Subject: [PATCH] add comment of function:_rename_or_remove_weight --- .../op_mapper/dygraph/onnx2paddle/opset9/opset.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py b/x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py index 202e62d..804c9b4 100644 --- a/x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py +++ b/x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py @@ -43,6 +43,17 @@ def _const_weight_or_none(node, necessary=False): def _rename_or_remove_weight(weights, origin_name, target_name=None, is_remove=True): + ''' + Rename parameters by Paddle's naming rule of parameters. + + Args: + weights(dict[String:np.ndarray]): Dict stored paramters, the key in weights is name of parameter. + origin_name(String): Name of parameter to eename or remove. + target_name(String, optional): if target_name is not None, add new key-value pair {target_name:weights[origin_name]} to weights, and target_name must follow paddle's naming rule of parameters. Default: None. + is_remove: if is_remove is True, remove origin key-value pair. Default: True. + Returns: + None + ''' if origin_name not in weights: raise KeyError('{} not a key in {}'.format(origin_name, weights)) if is_remove: -- GitLab