class_docstr: Image to Patch Embedding
  
  Class adapted from the implementation in https://github.com/MadryLab/smoothed-vit
  
  Original License stated above.
class_docstr_tok: ["Image","to","Patch","Embedding","Class","adapted","from","the","implementation","in","https",":","\/\/github.com\/MadryLab\/smoothed-vit","Original","License","stated","above","."]
docstr: Creates a convolution that mimics the embedding layer to be used for the ablation mask to
  track where the image was ablated.
  
  :param patch_size: The patch size used by the ViT.
  :param embed_dim: The embedding dimension used by the ViT.
  :param device: Which device to set the emdedding layer to.
  :param kwargs: Handles the remaining kwargs from the ViT configuration.
docstr_tok: ["Creates","a","convolution","that","mimics","the","embedding","layer","to","be","used","for","the","ablation","mask","to","track","where","the","image","was","ablated",".",":","param","patch_size",":","The","patch","size","used","by","the","ViT",".",":","param","embed_dim",":","The","embedding","dimension","used","by","the","ViT",".",":","param","device",":","Which","device","to","set","the","emdedding","layer","to",".",":","param","kwargs",":","Handles","the","remaining","kwargs","from","the","ViT","configuration","."]
code: def create(
      self, patch_size=None, embed_dim=None, device="cpu", **kwargs
  ) -> None:  # pylint: disable=W0613
      """
      Creates a convolution that mimics the embedding layer to be used for the ablation mask to
      track where the image was ablated.
  
      :param patch_size: The patch size used by the ViT.
      :param embed_dim: The embedding dimension used by the ViT.
      :param device: Which device to set the emdedding layer to.
      :param kwargs: Handles the remaining kwargs from the ViT configuration.
      """
  
      if patch_size is not None:
          self.patch_size = patch_size
      if embed_dim is not None:
          self.embed_dim = embed_dim
  
      self.proj = torch.nn.Conv2d(
          in_channels=self.in_channels,
          out_channels=self.embed_dim,
          kernel_size=self.patch_size,
          stride=self.patch_size,
          bias=False,
      )
      w_shape = self.proj.weight.shape
      self.proj.weight = torch.nn.Parameter(
          torch.ones(w_shape).to(device)
      )
  
file_path: adversarial-robustness-toolbox/art/estimators/certification/derandomized_smoothing/vision_transformers/pytorch.py
imports: from typing import Optional
  import torch
  from timm.models.vision_transformer import VisionTransformer
label_desc: Use image node_id 2 for calling the PatchEmbed obj's underlying member method code with example usage: obj.create(patch_size, embed_dim, device) without return types