class_docstr: Encoder for the Masked Autoencoder model [0].
  
  Encodes patch embeddings. Code inspired by [1].
  
  - [0]: Masked Autoencoder, 2021, https://arxiv.org/abs/2111.06377
  - [1]: https://github.com/facebookresearch/mae
  
  Attributes:
      seq_length:
          Token sequence length, including the class token.
      num_layers:
          Number of transformer blocks.
      num_heads:
          Number of attention heads.
      hidden_dim:
          Dimension of the input and output tokens.
      mlp_dim:
          Dimension of the MLP in the transformer block.
      dropout:
          Percentage of elements set to zero after the MLP in the transformer.
      attention_dropout:
          Percentage of elements set to zero after the attention head.
docstr: Creates a MAEEncoder from a torchvision ViT encoder.
docstr_tok: ["Creates","a","MAEEncoder","from","a","torchvision","ViT","encoder","."]
code: def from_vit_encoder(
      cls, vit_encoder: vision_transformer.Encoder
  ) -> MAEEncoder:
      """Creates a MAEEncoder from a torchvision ViT encoder."""
      # Create a new instance with dummy values as they will be overwritten
      # by the copied vit_encoder attributes
      encoder = cls(
          seq_length=1,
          num_layers=1,
          num_heads=1,
          hidden_dim=1,
          mlp_dim=1,
          dropout=0,
          attention_dropout=0,
      )
      encoder.pos_embedding = vit_encoder.pos_embedding
      encoder.dropout = vit_encoder.dropout
      encoder.layers = vit_encoder.layers
      encoder.ln = vit_encoder.ln
      return encoder
  
imports: from __future__ import annotations
  import math
  from functools import partial
  from typing import Callable, List, Optional
  import torch
  import torch.nn
  from torchvision.models import vision_transformer
  from torchvision.models.vision_transformer import ConvStemConfig
  from lightly.models import utils
label_desc: Use image node_id 2 for calling the MAEEncoder obj's underlying member method code with example usage: obj.from_vit_encoder(cls, vit_encoder) and returns: encoder