def METHOD_NAME(tmpdir, modelclass):
    """Test that scripted LightningModule is correctly saved and can be loaded."""
    model = modelclass()
    output_file = str(tmpdir / "model.pt")
    script = model.to_torchscript(file_path=output_file)
    loaded_script = torch.jit.load(output_file)
    assert torch.allclose(next(script.parameters()), next(loaded_script.parameters()))