def METHOD_NAME(
    self,
    dummy_inputs,
    model,
    output,
    rtol: float = None,
    atol: float = None,
    call_func: Callable = None,
):
    try:
        import onnx
        import onnxruntime as ort
    except ImportError:
        logger.warn(
            'Cannot validate the exported onnx file, because '
            'the installation of onnx or onnxruntime cannot be found')
        return
    def tensor_nested_numpify(tensors):
        if isinstance(tensors, (list, tuple)):
            return type(tensors)(tensor_nested_numpify(t) for t in tensors)
        if isinstance(tensors, Mapping):
            # return dict
            return {
                k: tensor_nested_numpify(t)
                for k, t in tensors.items()
            }
        if isinstance(tensors, tf.Tensor):
            t = tensors.cpu()
            return t.numpy()
        return tensors
    onnx_model = onnx.load(output)
    onnx.checker.check_model(onnx_model, full_check=True)
    ort_session = ort.InferenceSession(output)
    outputs_origin = call_func(
        dummy_inputs) if call_func is not None else model(dummy_inputs)
    if isinstance(outputs_origin, (Mapping, ModelOutputBase)):
        outputs_origin = list(
            tensor_nested_numpify(outputs_origin).values())
    elif isinstance(outputs_origin, (tuple, list)):
        outputs_origin = list(tensor_nested_numpify(outputs_origin))
    outputs = ort_session.run(
        None,
        tensor_nested_numpify(dummy_inputs),
    )
    outputs = tensor_nested_numpify(outputs)
    if isinstance(outputs, dict):
        outputs = list(outputs.values())
    elif isinstance(outputs, tuple):
        outputs = list(outputs)
    tols = {}
    if rtol is not None:
        tols['rtol'] = rtol
    if atol is not None:
        tols['atol'] = atol
    if not compare_arguments_nested('Onnx model output match failed',
                                    outputs, outputs_origin, **tols):
        raise RuntimeError(
            'export onnx failed because of validation error.')