def test_model_saves_with_input_sample(tmp_path):
    """Test that ONNX model saves with input sample and size is greater than 3 MB."""
    model = BoringModel()
    input_sample = torch.randn((1, 32))

    file_path = os.path.join(tmp_path, "os.path.onnx")
    model.to_onnx(file_path, input_sample)
    assert os.path.isfile(file_path)
    assert os.path.getsize(file_path) > 4e2

    file_path = Path(tmp_path) / "pathlib.onnx"
    model.to_onnx(file_path, input_sample)
    assert os.path.isfile(file_path)
    assert os.path.getsize(file_path) > 4e2

    file_path = BytesIO()
    model.to_onnx(file_path=file_path, input_sample=input_sample)
    assert len(file_path.getvalue()) > 4e2
Test that ONNX model saves with input sample and size is greater than 3 MB.
tests/tests_pytorch/models/test_onnx.py