code: def test_tiles_split_merge_cuda():
      class MaxChannelIntensity(nn.Module):
          def __init__(self):
              super().__init__()
  
          def forward(self, input):
              max_channel, _ = torch.max(input, dim=1, keepdim=True)
              return max_channel
  
      image = np.random.random((5000, 5000, 3)).astype(np.uint8)
  
      tiler = ImageSlicer(
          image.shape,
          tile_size=(512, 512),
          tile_step=(256, 256),
          weight="pyramid",
      )
      tiles = [
          tensor_from_rgb_image(tile) for tile in tiler.split(image)
      ]
  
      model = MaxChannelIntensity().eval().cuda()
  
      merger = CudaTileMerger(tiler.target_shape, 1, tiler.weight)
      for tiles_batch, coords_batch in DataLoader(
          list(zip(tiles, tiler.crops)), batch_size=8, pin_memory=True
      ):
          tiles_batch = tiles_batch.float().cuda()
          pred_batch = model(tiles_batch)
  
          merger.integrate_batch(pred_batch, coords_batch)
  
      merged = np.moveaxis(to_numpy(merger.merge()), 0, -1).astype(
          np.uint8
      )
      merged = tiler.crop_to_orignal_size(merged)
  
      np.testing.assert_equal(merged, image.max(axis=2, keepdims=True))
  
file_path: pytorch-toolbelt/tests/test_tiles.py
imports: import numpy
  import torch
  from pytorch_toolbelt.inference.tiles import ImageSlicer, CudaTileMerger
  from pytorch_toolbelt.utils.torch_utils import tensor_from_rgb_image, rgb_image_from_tensor, to_numpy
  from torch import nn
  from torch.utils.data import DataLoader
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: test_tiles_split_merge_cuda() and returns: max_channel