code: def test_non_blocking():
      """Tests that non_blocking=True only gets passed on Tensor.to, but not on other objects."""
      trainer = Trainer()
  
      batch = torch.zeros(2, 3)
      with patch.object(batch, "to", wraps=batch.to) as mocked:
          batch = trainer.strategy.batch_to_device(
              batch, torch.device("cuda:0")
          )
          mocked.assert_called_with(
              torch.device("cuda", 0), non_blocking=True
          )
  
      class BatchObject:
          def to(self, *args, **kwargs):
              pass
  
      batch = BatchObject()
      with patch.object(batch, "to", wraps=batch.to) as mocked:
          batch = trainer.strategy.batch_to_device(
              batch, torch.device("cuda:0")
          )
          mocked.assert_called_with(torch.device("cuda", 0))
  
imports: import os
  from collections import namedtuple
  from unittest import mock
  from unittest.mock import patch
  import pytest
  import torch
  from lightning.fabric.plugins.environments import TorchElasticEnvironment
  from lightning.fabric.utilities.device_parser import _parse_gpu_ids
  from lightning.pytorch import Trainer, seed_everything
  from lightning.pytorch.accelerators import CPUAccelerator, CUDAAccelerator
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  import tests_pytorch.helpers.pipelines
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
label_desc: Use image node_id 6 for calling a global function with example usage: test_non_blocking() without return types