class_docstr: Extracts patches from a collection of images.
  
  Read more in the :ref:`User Guide <image_feature_extraction>`.
  
  .. versionadded:: 0.9
  
  Parameters
  ----------
  patch_size : tuple of int (patch_height, patch_width), default=None
      The dimensions of one patch. If set to None, the patch size will be
      automatically set to `(img_height // 10, img_width // 10)`, where
      `img_height` and `img_width` are the dimensions of the input images.
  
  max_patches : int or float, default=None
      The maximum number of patches per image to extract. If `max_patches` is
      a float in (0, 1), it is taken to mean a proportion of the total number
      of patches. If set to None, extract all possible patches.
  
  random_state : int, RandomState instance, default=None
      Determines the random number generator used for random sampling when
      `max_patches is not None`. Use an int to make the randomness
      deterministic.
      See :term:`Glossary <random_state>`.
  
  See Also
  --------
  reconstruct_from_patches_2d : Reconstruct image from all of its patches.
  
  Notes
  -----
  This estimator is stateless and does not need to be fitted. However, we
  recommend to call :meth:`fit_transform` instead of :meth:`transform`, as
  parameter validation is only performed in :meth:`fit`.
  
  Examples
  --------
  >>> from sklearn.datasets import load_sample_images
  >>> from sklearn.feature_extraction import image
  >>> # Use the array data from the second image in this dataset:
  >>> X = load_sample_images().images[1]
  >>> X = X[None, ...]
  >>> print(f"Image shape: {X.shape}")
  Image shape: (1, 427, 640, 3)
  >>> pe = image.PatchExtractor(patch_size=(10, 10))
  >>> pe_trans = pe.transform(X)
  >>> print(f"Patches shape: {pe_trans.shape}")
  Patches shape: (263758, 10, 10, 3)
  >>> X_reconstructed = image.reconstruct_from_patches_2d(pe_trans, X.shape[1:])
  >>> print(f"Reconstructed shape: {X_reconstructed.shape}")
  Reconstructed shape: (427, 640, 3)
class_docstr_tok: ["Extracts","patches","from","a","collection","of","images",".","Read","more","in","the",":","ref",":","`","User","Guide","<","image_feature_extraction",">","`",".","..","versionadded",":",":","0.9","Parameters","--","--","--","--","--","patch_size",":","tuple","of","int","(","patch_height",",","patch_width",")",",","default=None","The","dimensions","of","one","patch",".","If","set","to","None",",","the","patch","size","will","be","automatically","set","to","`","(","img_height","\/\/","10",",","img_width","\/\/","10",")","`",",","where","`","img_height","`","and","`","img_width","`","are","the","dimensions","of","the","input","images",".","max_patches",":","int","or","float",",","default=None","The","maximum","number","of","patches","per","image","to","extract",".","If","`","max_patches","`","is","a","float","in","(","0",",","1",")",",","it","is","taken","to","mean","a","proportion","of","the","total","number","of","patches",".","If","set","to","None",",","extract","all","possible","patches",".","random_state",":","int",",","RandomState","instance",",","default=None","Determines","the","random","number","generator","used","for","random","sampling","when","`","max_patches","is","not","None","`",".","Use","an","int","to","make","the","randomness","deterministic",".","See",":","term",":","`","Glossary","<","random_state",">","`",".","See","Also","--","--","--","--","reconstruct_from_patches_2d",":","Reconstruct","image","from","all","of","its","patches",".","Notes","--","--","-","This","estimator","is","stateless","and","does","not","need","to","be","fitted",".","However",",","we","recommend","to","call",":","meth",":","`","fit_transform","`","instead","of",":","meth",":","`","transform","`",",","as","parameter","validation","is","only","performed","in",":","meth",":","`","fit","`",".","Examples","--","--","--","--",">",">",">","from","sklearn.datasets","import","load_sample_images",">",">",">","from","sklearn.feature_extraction","import","image",">",">",">","#","Use","the","array","data","from","the","second","image","in","this","dataset",":",">",">",">","X","=","load_sample_images","(",")",".images","[","1","]",">",">",">","X","=","X","[","None",",","...","]",">",">",">","print","(","f","''","Image","shape",":","{","X.shape","}","''",")","Image","shape",":","(","1",",","427",",","640",",","3",")",">",">",">","pe","=","image.PatchExtractor","(","patch_size=","(","10",",","10",")",")",">",">",">","pe_trans","=","pe.transform","(","X",")",">",">",">","print","(","f","''","Patches","shape",":","{","pe_trans.shape","}","''",")","Patches","shape",":","(","263758",",","10",",","10",",","3",")",">",">",">","X_reconstructed","=","image.reconstruct_from_patches_2d","(","pe_trans",",","X.shape","[","1",":","]",")",">",">",">","print","(","f","''","Reconstructed","shape",":","{","X_reconstructed.shape","}","''",")","Reconstructed","shape",":","(","427",",","640",",","3",")"]
docstr: Only validate the parameters of the estimator.
  
  This method allows to: (i) validate the parameters of the estimator  and
  (ii) be consistent with the scikit-learn transformer API.
  
  Parameters
  ----------
  X : ndarray of shape (n_samples, image_height, image_width) or                 (n_samples, image_height, image_width, n_channels)
      Array of images from which to extract patches. For color images,
      the last dimension specifies the channel: a RGB image would have
      `n_channels=3`.
  
  y : Ignored
      Not used, present for API consistency by convention.
  
  Returns
  -------
  self : object
      Returns the instance itself.
docstr_tok: ["Only","validate","the","parameters","of","the","estimator",".","This","method","allows","to",":","(","i",")","validate","the","parameters","of","the","estimator","and","(","ii",")","be","consistent","with","the","scikit-learn","transformer","API",".","Parameters","--","--","--","--","--","X",":","ndarray","of","shape","(","n_samples",",","image_height",",","image_width",")","or","(","n_samples",",","image_height",",","image_width",",","n_channels",")","Array","of","images","from","which","to","extract","patches",".","For","color","images",",","the","last","dimension","specifies","the","channel",":","a","RGB","image","would","have","`","n_channels=3","`",".","y",":","Ignored","Not","used",",","present","for","API","consistency","by","convention",".","Returns","--","--","--","-","self",":","object","Returns","the","instance","itself","."]
code: def fit(self, X, y=None):
      """Only validate the parameters of the estimator.
  
          This method allows to: (i) validate the parameters of the estimator  and
          (ii) be consistent with the scikit-learn transformer API.
  
          Parameters
          ----------
          X : ndarray of shape (n_samples, image_height, image_width) or \
                  (n_samples, image_height, image_width, n_channels)
              Array of images from which to extract patches. For color images,
              the last dimension specifies the channel: a RGB image would have
              `n_channels=3`.
  
          y : Ignored
              Not used, present for API consistency by convention.
  
          Returns
          -------
          self : object
              Returns the instance itself.
          """
      return self
  
imports: from itertools import product
  from numbers import Integral, Number, Real
  import numpy
  from numpy.lib.stride_tricks import as_strided
  from scipy import sparse
  from ..base import BaseEstimator, TransformerMixin, _fit_context
  from ..utils import check_array, check_random_state
  from ..utils._param_validation import Hidden, Interval, RealNotInt, validate_params
label_desc: Use image node_id 2 for calling the PatchExtractor obj's underlying member method code with example usage: obj.fit(X, y) and returns: self