import copy


def _convert_params(node, mapper):
    """
    Call mapper to convert node's params from ONNX to MindSpore.

    Args:
        node (GraphNode): Our defined GraphNode instance.
        mapper (Mapper): The mapper instance which indicating conversion method.

    Returns:
        str, op name in MindSpore
        dict, MindSpore parameters
        dict, MindSpore settings
        dict, weights of the node
    """
    params = copy.deepcopy(node.node_params)
    params.update({"input_shape": node.input_shape,
                   "output_shape": node.output_shape})

    op_in_ms, ms_params, ms_settings, weights = mapper.convert(op_name=node.op_name,
                                                               params=params,
                                                               weights=node.weight)
    if "input_shape" in ms_params:
        ms_params.pop("input_shape")
    if "output_shape" in ms_params:
        ms_params.pop("output_shape")

    if op_in_ms:
        return op_in_ms, ms_params, ms_settings, weights

    return node.op_name, node.node_params, dict(), dict()