class_docstr: Container for performing patch-level image data augmentation.
  
  .. image:: _static/img/PatchSequential.png
  
  PatchSequential breaks input images into patches by a given grid size, which will be resembled back
  afterwards.
  
  Different image processing and augmentation methods will be performed on each patch region as
  in :cite:`lin2021patch`.
  
  Args:
      *args: a list of processing modules.
      grid_size: controls the grid board separation.
      padding: same or valid padding. If same padding, it will pad to include all pixels if the input
          tensor cannot be divisible by grid_size. If valid padding, the redundant border will be removed.
      same_on_batch: apply the same transformation across the batch.
          If None, it will not overwrite the function-wise settings.
      keepdim: whether to keep the output shape the same as input (True) or broadcast it
          to the batch form (False). If None, it will not overwrite the function-wise settings.
      patchwise_apply: apply image processing args will be applied patch-wisely.
          if ``True``, the number of args must be equal to grid number.
          if ``False``, the image processing args will be applied as a sequence to all patches.
      random_apply: randomly select a sublist (order agnostic) of args to
          apply transformation.
          If ``int`` (batchwise mode only), a fixed number of transformations will be selected.
          If ``(a,)`` (batchwise mode only), x number of transformations (a <= x <= len(args)) will be selected.
          If ``(a, b)`` (batchwise mode only), x number of transformations (a <= x <= b) will be selected.
          If ``True``, the whole list of args will be processed in a random order.
          If ``False`` and not ``patchwise_apply``, the whole list of args will be processed in original order.
          If ``False`` and ``patchwise_apply``, the whole list of args will be processed in original order
          location-wisely.
  
  .. note::
      Transformation matrix returned only considers the transformation applied in ``kornia.augmentation`` module.
      Those transformations in ``kornia.geometry`` will not be taken into account.
  
  .. note::
      See a working example `here <https://kornia.github.io/tutorials/nbs/data_patch_sequential.html>`__.
  
  Examples:
      >>> import kornia.augmentation as K
      >>> input = torch.randn(2, 3, 224, 224)
      >>> seq = PatchSequential(
      ...     ImageSequential(
      ...         K.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=0.5),
      ...         K.RandomPerspective(0.2, p=0.5),
      ...         K.RandomSolarize(0.1, 0.1, p=0.5),
      ...     ),
      ...     K.RandomAffine(360, p=1.0),
      ...     ImageSequential(
      ...         K.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=0.5),
      ...         K.RandomPerspective(0.2, p=0.5),
      ...         K.RandomSolarize(0.1, 0.1, p=0.5),
      ...     ),
      ...     K.RandomSolarize(0.1, 0.1, p=0.1),
      ...     grid_size=(2,2),
      ...     patchwise_apply=True,
      ...     same_on_batch=True,
      ...     random_apply=False,
      ... )
      >>> out = seq(input)
      >>> out.shape
      torch.Size([2, 3, 224, 224])
      >>> out1 = seq(input, params=seq._params)
      >>> torch.equal(out, out1)
      True
  
  Perform ``OneOf`` transformation with ``random_apply=1`` and ``random_apply_weights`` in ``PatchSequential``.
  
      >>> import kornia
      >>> input = torch.randn(2, 3, 224, 224)
      >>> seq = PatchSequential(
      ...     ImageSequential(
      ...         K.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=0.5),
      ...         K.RandomPerspective(0.2, p=0.5),
      ...         K.RandomSolarize(0.1, 0.1, p=0.5),
      ...     ),
      ...     K.RandomAffine(360, p=1.0),
      ...     K.RandomSolarize(0.1, 0.1, p=0.1),
      ...     grid_size=(2,2),
      ...     patchwise_apply=False,
      ...     random_apply=1,
      ...     random_apply_weights=[0.5, 0.3, 0.8]
      ... )
      >>> out = seq(input)
      >>> out.shape
      torch.Size([2, 3, 224, 224])
class_docstr_tok: ["Container","for","performing","patch-level","image","data","augmentation",".","..","image",":",":","_static\/img\/PatchSequential.png","PatchSequential","breaks","input","images","into","patches","by","a","given","grid","size",",","which","will","be","resembled","back","afterwards",".","Different","image","processing","and","augmentation","methods","will","be","performed","on","each","patch","region","as","in",":","cite",":","`","lin2021patch","`",".","Args",":","*","args",":","a","list","of","processing","modules",".","grid_size",":","controls","the","grid","board","separation",".","padding",":","same","or","valid","padding",".","If","same","padding",",","it","will","pad","to","include","all","pixels","if","the","input","tensor","can","not","be","divisible","by","grid_size",".","If","valid","padding",",","the","redundant","border","will","be","removed",".","same_on_batch",":","apply","the","same","transformation","across","the","batch",".","If","None",",","it","will","not","overwrite","the","function-wise","settings",".","keepdim",":","whether","to","keep","the","output","shape","the","same","as","input","(","True",")","or","broadcast","it","to","the","batch","form","(","False",")",".","If","None",",","it","will","not","overwrite","the","function-wise","settings",".","patchwise_apply",":","apply","image","processing","args","will","be","applied","patch-wisely",".","if","``","True","``",",","the","number","of","args","must","be","equal","to","grid","number",".","if","``","False","``",",","the","image","processing","args","will","be","applied","as","a","sequence","to","all","patches",".","random_apply",":","randomly","select","a","sublist","(","order","agnostic",")","of","args","to","apply","transformation",".","If","``","int","``","(","batchwise","mode","only",")",",","a","fixed","number","of","transformations","will","be","selected",".","If","``","(","a",",",")","``","(","batchwise","mode","only",")",",","x","number","of","transformations","(","a","<","=","x","<","=","len","(","args",")",")","will","be","selected",".","If","``","(","a",",","b",")","``","(","batchwise","mode","only",")",",","x","number","of","transformations","(","a","<","=","x","<","=","b",")","will","be","selected",".","If","``","True","``",",","the","whole","list","of","args","will","be","processed","in","a","random","order",".","If","``","False","``","and","not","``","patchwise_apply","``",",","the","whole","list","of","args","will","be","processed","in","original","order",".","If","``","False","``","and","``","patchwise_apply","``",",","the","whole","list","of","args","will","be","processed","in","original","order","location-wisely",".","..","note",":",":","Transformation","matrix","returned","only","considers","the","transformation","applied","in","``","kornia.augmentation","``","module",".","Those","transformations","in","``","kornia.geometry","``","will","not","be","taken","into","account",".","..","note",":",":","See","a","working","example","`","here","<","https",":","\/\/kornia.github.io\/tutorials\/nbs\/data_patch_sequential.html",">","`","__",".","Examples",":",">",">",">","import","kornia.augmentation","as","K",">",">",">","input","=","torch.randn","(","2",",","3",",","224",",","224",")",">",">",">","seq","=","PatchSequential","(","...","ImageSequential","(","...","K.ColorJiggle","(","0.1",",","0.1",",","0.1",",","0.1",",","p=0.5",")",",","...","K.RandomPerspective","(","0.2",",","p=0.5",")",",","...","K.RandomSolarize","(","0.1",",","0.1",",","p=0.5",")",",","...",")",",","...","K.RandomAffine","(","360",",","p=1.0",")",",","...","ImageSequential","(","...","K.ColorJiggle","(","0.1",",","0.1",",","0.1",",","0.1",",","p=0.5",")",",","...","K.RandomPerspective","(","0.2",",","p=0.5",")",",","...","K.RandomSolarize","(","0.1",",","0.1",",","p=0.5",")",",","...",")",",","...","K.RandomSolarize","(","0.1",",","0.1",",","p=0.1",")",",","...","grid_size=","(","2,2",")",",","...","patchwise_apply=True",",","...","same_on_batch=True",",","...","random_apply=False",",","...",")",">",">",">","out","=","seq","(","input",")",">",">",">","out.shape","torch.Size","(","[","2",",","3",",","224",",","224","]",")",">",">",">","out1","=","seq","(","input",",","params=seq._params",")",">",">",">","torch.equal","(","out",",","out1",")","True","Perform","``","OneOf","``","transformation","with","``","random_apply=1","``","and","``","random_apply_weights","``","in","``","PatchSequential","``",".",">",">",">","import","kornia",">",">",">","input","=","torch.randn","(","2",",","3",",","224",",","224",")",">",">",">","seq","=","PatchSequential","(","...","ImageSequential","(","...","K.ColorJiggle","(","0.1",",","0.1",",","0.1",",","0.1",",","p=0.5",")",",","...","K.RandomPerspective","(","0.2",",","p=0.5",")",",","...","K.RandomSolarize","(","0.1",",","0.1",",","p=0.5",")",",","...",")",",","...","K.RandomAffine","(","360",",","p=1.0",")",",","...","K.RandomSolarize","(","0.1",",","0.1",",","p=0.1",")",",","...","grid_size=","(","2,2",")",",","...","patchwise_apply=False",",","...","random_apply=1",",","...","random_apply_weights=","[","0.5",",","0.3",",","0.8","]","...",")",">",">",">","out","=","seq","(","input",")",">",">",">","out.shape","torch.Size","(","[","2",",","3",",","224",",","224","]",")"]
code: def inverse_masks(  # type: ignore[override]
      self,
      input: Tensor,
      params: List[PatchParamItem],
      extra_args: Dict[str, Any] = {},
  ) -> Tensor:
      if self.is_intensity_only():
          return input
  
      raise NotImplementedError(
          "PatchSequential inverse cannot be used with geometric transformations."
      )
  
imports: from itertools import cycle, islice
  from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
  import torch
  import kornia.augmentation
  from kornia.augmentation.base import _AugmentationBase
  from kornia.contrib.extract_patches import extract_tensor_patches
  from kornia.core import Module, Tensor, concatenate
  from kornia.core import pad
  from kornia.geometry.boxes import Boxes
  from kornia.geometry.keypoints import Keypoints
  from .base import SequentialBase
  from .image import ImageSequential
  from .ops import InputSequentialOps
  from .params import ParamItem, PatchParamItem
label_desc: Use image node_id 11 for calling the PatchSequential obj's underlying member method code with example usage: obj.inverse_masks(input, params, extra_args) and returns: input