code: def window_partition(
      data: torch.Tensor, window_size: Tuple[int, int] = (7, 7)
  ) -> torch.Tensor:
      """Window partition function.
      Args:
          data (torch.Tensor): Input tensor of the shape [B, C, H, W].
          window_size (Tuple[int, int], optional): Window size to be applied. Default (7, 7)
      Returns:
          windows (torch.Tensor): Unfolded input tensor of the shape [B * windows, window_size[0], window_size[1], C].
      """
      # Get size of input
      b, c, h, w = data.shape
      # Unfold input
      windows = data.view(
          b,
          c,
          h // window_size[0],
          window_size[0],
          w // window_size[1],
          window_size[1],
      )
      # Permute and reshape to [B * windows, window_size[0], window_size[1], channels]
      windows = (
          windows.permute(0, 2, 4, 3, 5, 1)
          .contiguous()
          .view(-1, window_size[0], window_size[1], c)
      )
      return windows
  
imports: from typing import Tuple
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: window_partition(data, window_size) and returns: windows