def METHOD_NAME(
    input: Any,
    alg_cls: Type[Algorithm],
    tmp_path: pathlib.Path,
):
    """Tests onnx export and runtime"""
    pytest.importorskip('onnx')
    pytest.importorskip('onnxruntime')
    import onnx
    import onnxruntime as ort
    surgery_method = get_surgery_method(alg_cls)
    model = get_alg_model(alg_cls)
    alg_kwargs = get_alg_kwargs(alg_cls)
    alg_kwargs = algo_kwargs.get(surgery_method, alg_kwargs)
    surgery_method(model, **alg_kwargs)
    model.eval()
    onnx_path = os.path.join(tmp_path, 'model.onnx')
    torch.onnx.export(
        model,
        (input,),
        onnx_path,
        input_names=['input'],
        output_names=['output'],
    )
    # check onnx model
    onnx_model = onnx.load(onnx_path)
    onnx.checker.check_model(onnx_model)  # type: ignore (third-party)
    # run inference
    ort_session = ort.InferenceSession(onnx_path)
    outputs = ort_session.run(
        None,
        {'input': input[0].numpy()},
    )
    torch.testing.assert_close(
        outputs[0],
        model(input).detach().numpy(),
        rtol=1e-4,  # lower tolerance for ONNX
        atol=1e-3,  # lower tolerance for ONNX
    )