code: def test_patchify(self, seed=0):
      torch.manual_seed(seed)
      batch_size, channels, height, width = (2, 3, 8, 8)
      patch_size = 4
      images = torch.rand(batch_size, channels, height, width)
      batch_patches = utils.patchify(images, patch_size)
  
      height_patches = height // patch_size
      width_patches = width // patch_size
      num_patches = height_patches * width_patches
      patch_dim = channels * patch_size**2
  
      self.assertListEqual(
          list(batch_patches.shape),
          [batch_size, num_patches, patch_dim],
      )
  
      # make sure that patches are correctly formed
      for image, img_patches in zip(images, batch_patches):
          for i in range(height_patches):
              for j in range(width_patches):
                  # extract patch from original image
                  expected_patch = image[
                      :,
                      i * patch_size : (i + 1) * patch_size,
                      j * patch_size : (j + 1) * patch_size,
                  ]
                  # permute and flatten to match order of patchified images
                  expected_patch = expected_patch.permute(
                      1, 2, 0
                  ).flatten()
                  img_patch = img_patches[i * width_patches + j]
                  self._assert_tensor_equal(img_patch, expected_patch)
  
imports: import copy
  import unittest
  import torch
  import torch.nn
  from lightly.models import utils
  from lightly.models.utils import _no_grad_trunc_normal, activate_requires_grad, batch_shuffle, batch_unshuffle, deactivate_requires_grad, nearest_neighbors, normalize_weight, update_momentum
label_desc: Use image node_id 14 for calling the TestModelUtils obj's underlying member method code with example usage: obj.test_patchify(seed) without return types