code: def test_suggestion_with_non_finite_values(tmpdir):
      """Test that non-finite values does not alter results."""
      seed_everything(1)
  
      class CustomBoringModel(BoringModel):
          def __init__(self, lr):
              super().__init__()
              self.lr = lr
  
          def configure_optimizers(self):
              return torch.optim.SGD(self.parameters(), lr=self.lr)
  
      model = CustomBoringModel(lr=1e-2)
      trainer = Trainer(default_root_dir=tmpdir, max_epochs=3)
      tuner = Tuner(trainer)
      lr_finder = tuner.lr_find(model)
  
      before_lr = lr_finder.suggestion()
      lr_finder.results["loss"][-1] = float("nan")
      after_lr = lr_finder.suggestion()
  
      assert before_lr is not None
      assert after_lr is not None
      assert (
          before_lr == after_lr
      ), "Learning rate was altered because of non-finite loss values"
  
imports: import logging
  import math
  import os
  from copy import deepcopy
  from typing import Any
  from unittest import mock
  import pytest
  import torch
  from lightning.pytorch import Trainer, seed_everything
  from lightning.pytorch.callbacks.lr_finder import LearningRateFinder
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.tuner.lr_finder import _LRFinder
  from lightning.pytorch.tuner.tuning import Tuner
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.types import STEP_OUTPUT
  from lightning_utilities.test.warning import no_warning_call
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
  from tests_pytorch.helpers.utils import getattr_recursive
label_desc: Use image node_id 10 for calling a global function with example usage: test_suggestion_with_non_finite_values(tmpdir) and returns: torch