docstr: Patchify without overlap
  
  Args:
      x: tensor of shape [B, C, H, W]
      patch_size: size of the patch
  
  Returns:
      Tensor of shape [B*num_patches_H*num_patches_W, patch_size^2, C]
docstr_tok: ["Patchify","without","overlap","Args",":","x",":","tensor","of","shape","[","B",",","C",",","H",",","W","]","patch_size",":","size","of","the","patch","Returns",":","Tensor","of","shape","[","B","*","num_patches_H","*","num_patches_W",",","patch_size^2",",","C","]"]
code: def _window_partition(self, x: Tensor, patch_size: int) -> Tensor:
      """Patchify without overlap
  
      Args:
          x: tensor of shape [B, C, H, W]
          patch_size: size of the patch
  
      Returns:
          Tensor of shape [B*num_patches_H*num_patches_W, patch_size^2, C]
      """
      # extract_patches_nonoverlapping + window_partition
      __pad = False
      B, C, H, W = x.shape
      if H % patch_size != 0 or W % patch_size != 0:
          if not __pad:
              raise ValueError(
                  f"input H, W={(H, W)} not divisible by patch size ({patch_size})"
              )
          x = self._pad_to_factor(x, factor=patch_size)
          _, H, W, _ = x.shape
  
      n_patches_H = H // patch_size
      n_patches_W = W // patch_size
  
      return (
          x.reshape(
              B, C, n_patches_H, patch_size, n_patches_W, patch_size
          )
          .permute(
              0, 2, 4, 3, 5, 1
          )  # [B, num_patches_H, num_patches_W, C, patch_size, patch_size]
          .contiguous()
          .reshape(B * n_patches_H * n_patches_W, patch_size**2, C)
      )
  
file_path: NeuralCompression/projects/torch_vct/neural/patcher.py
imports: import math
  from typing import NamedTuple, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
label_desc: Use image node_id 4 for calling the Patcher obj's underlying member method code with example usage: obj._window_partition(x, patch_size) and returns: x