code: def window_unpartition(
      windows: paddle.Tensor,
      window_size: int,
      pad_hw: Tuple[int, int],
      hw: Tuple[int, int],
  ) -> paddle.Tensor:
      """
      Window unpartition into original sequences and removing padding.
      Args:
          x (tensor): input tokens with [B * num_windows, window_size, window_size, C].
          window_size (int): window size.
          pad_hw (Tuple): padded height and width (Hp, Wp).
          hw (Tuple): original height and width (H, W) before padding.
  
      Returns:
          x: unpartitioned sequences with [B, H, W, C].
      """
      Hp, Wp = pad_hw
      H, W = hw
      B = windows.shape[0] // (Hp * Wp // window_size // window_size)
      x = windows.reshape(
          [
              B,
              Hp // window_size,
              Wp // window_size,
              window_size,
              window_size,
              -1,
          ]
      )
      x = x.transpose([0, 1, 3, 2, 4, 5]).reshape([B, Hp, Wp, -1])
  
      if Hp > H or Wp > W:
          x = x[:, :H, :W, :]
      return x
  
imports: import sys
  import os
  from functools import partial
  from typing import Optional, Tuple, Type
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from .common import LayerNorm2d, MLPBlock
label_desc: Use image node_id 2 for calling a global function with example usage: window_unpartition(windows, window_size, pad_hw, hw) and returns: x