def test_tpu_clip_grad_by_value(tmp_path):
    """Test if clip_gradients by value works on TPU."""
    trainer_options = {
        "default_root_dir": tmp_path,
        "enable_progress_bar": False,
        "max_epochs": 4,
        "accelerator": "tpu",
        "devices": 1,
        "limit_train_batches": 3,
        "limit_val_batches": 3,
        "gradient_clip_val": 0.5,
        "gradient_clip_algorithm": "value",
    }

    model = BoringModel()
    tpipes.run_model_test(trainer_options, model, with_hpc=False)
Test if clip_gradients by value works on TPU.
tests/tests_pytorch/models/test_tpu.py