code: def test_get_available_flops(xla_available):
      with mock.patch(
          "torch.cuda.get_device_name", return_value="NVIDIA H100 PCIe"
      ):
          flops = get_available_flops(
              torch.device("cuda"), torch.bfloat16
          )
      assert flops == 756e12
  
      with pytest.warns(match="not found for 'CocoNut"), mock.patch(
          "torch.cuda.get_device_name", return_value="CocoNut"
      ):
          assert (
              get_available_flops(torch.device("cuda"), torch.bfloat16)
              is None
          )
  
      with pytest.warns(
          match="t4' does not support torch.bfloat"
      ), mock.patch("torch.cuda.get_device_name", return_value="t4"):
          assert (
              get_available_flops(torch.device("cuda"), torch.bfloat16)
              is None
          )
  
      from torch_xla.experimental import tpu
  
      assert isinstance(tpu, Mock)
      tpu.get_tpu_env.return_value = {"TYPE": "V4"}
  
      flops = get_available_flops(torch.device("xla"), torch.bfloat16)
      assert flops == 275e12
  
      tpu.get_tpu_env.return_value = {"TYPE": "V1"}
      with pytest.warns(match="not found for TPU 'V1'"):
          assert (
              get_available_flops(torch.device("xla"), torch.bfloat16)
              is None
          )
  
      tpu.reset_mock()
  
file_path: pytorch-lightning/tests/tests_fabric/utilities/test_throughput.py
imports: from unittest import mock
  from unittest.mock import Mock, call
  import pytest
  import torch
  from lightning.fabric import Fabric
  from lightning.fabric.plugins import Precision
  from lightning.fabric.utilities.throughput import Throughput, ThroughputMonitor, _MonotonicWindow, get_available_flops, measure_flops
  from tests_fabric.helpers.runif import RunIf
  from tests_fabric.test_fabric import BoringModel
label_desc: Use image node_id 2 for calling a global function with example usage: test_get_available_flops(xla_available) without return types