class_docstr: This class defines the pre-norm `Transformer encoder <https://arxiv.org/abs/1706.03762>`_
  with the addition of windowed attention.
  
  This class first partitions the input sequence into a series of windows (with
  an optional offset to use when defining windows). Then, it calls a
  TransformerEncoder module. Then, it undoes windowing.
  
  Args:
      opts: Command line arguments.
      embed_dim: :math:`C_{in}` from an expected input of size :math:`(N, P, C_{in})`.
      ffn_latent_dim: Inner dimension of the FFN.
      num_heads: Number of heads in multi-head attention. Default: 8.
      attn_dropout: Dropout rate for attention in multi-head attention. Default: 0.0.
      dropout: Dropout rate. Default: 0.0.
      ffn_dropout: Dropout between FFN layers. Default: 0.0.
      transformer_norm_layer: Normalization layer. Default: layer_norm.
      stochastic_dropout: Stochastic dropout setting. Default: 0.0.
      window_size: The size of the window, if using windowed attention. Default: None.
      window_shift: The size of the shift, if using shifted windowed attention. Default: None.
  
  Shape:
      - Input: :math:`(N, P, C_{in})` where :math:`N` is batch size, :math:`P` is number of patches,
      and :math:`C_{in}` is input embedding dim
      - Output: same shape as the input
code: def __repr__(self) -> str:
      # Remove closing parentheses from parent __repr__ call.
      ret = super().__repr__()[:-1]
      return f"{ret}, {self.window_size}, {self.window_shift})"
  
file_path: ml-cvnets/cvnets/modules/windowed_transformer.py
imports: import argparse
  from typing import Optional, Tuple
  import torch
  from torch import Tensor
  from cvnets.layers import token_merging
  from cvnets.modules import transformer
label_desc: Use image node_id 3 for calling the WindowedTransformerEncoder obj's underlying member method code with example usage: obj.__repr__() and returns: ret, str, self, str, self, str