class_docstr: Wrapper for character aware CNN embeddings for tokens.
  Attributes:
      embedding (CNNCharacterEmbedding): Character embedding
class_docstr_tok: ["Wrapper","for","character","aware","CNN","embeddings","for","tokens",".","Attributes",":","embedding","(","CNNCharacterEmbedding",")",":","Character","embedding"]
docstr: Factory method to construct an instance of CharacterEmbedding from
  the module's config object and the field's metadata object.
  
  Args:
      config (CharFeatConfig): Configuration object specifying all the
          parameters of CharacterEmbedding.
      metadata (FieldMeta): Object containing this field's metadata.
  
  Returns:
      type: An instance of CharacterEmbedding.
docstr_tok: ["Factory","method","to","construct","an","instance","of","CharacterEmbedding","from","the","module","'s","config","object","and","the","field","'s","metadata","object",".","Args",":","config","(","CharFeatConfig",")",":","Configuration","object","specifying","all","the","parameters","of","CharacterEmbedding",".","metadata","(","FieldMeta",")",":","Object","containing","this","field","'s","metadata",".","Returns",":","type",":","An","instance","of","CharacterEmbedding","."]
code: def from_config(
      cls,
      config: CharFeatConfig,
      metadata: Optional[FieldMeta] = None,
      vocab_size: Optional[int] = None,
  ):
      """Factory method to construct an instance of CharacterEmbedding from
      the module's config object and the field's metadata object.
  
      Args:
          config (CharFeatConfig): Configuration object specifying all the
              parameters of CharacterEmbedding.
          metadata (FieldMeta): Object containing this field's metadata.
  
      Returns:
          type: An instance of CharacterEmbedding.
  
      """
      if vocab_size is None:
          vocab_size = metadata.vocab_size
  
      if config.highway_layers is not None:
          warnings.warn(
              "Specifying highway_layers is deprecated, use ConnectionConfig instead.",
              DeprecationWarning,
          )
          highway_layers = config.highway_layers
          resmlp_layers = 0
          resmlp_dropout = 0
      else:
          if config.connection.connection_type == "highway":
              highway_layers = config.connection.num_layers
              resmlp_layers = 0
              resmlp_dropout = 0
          elif config.connection.connection_type == "resmlp":
              highway_layers = 0
              resmlp_layers = config.connection.num_layers
              resmlp_dropout = config.connection.dropout
          else:
              raise NotImplementedError(
                  "Connection type should be either 'highway' or 'resmlp'."
              )
  
      return cls(
          vocab_size,
          config.embed_dim,
          config.cnn.kernel_num,
          config.cnn.kernel_sizes,
          highway_layers,
          config.projection_dim,
          resmlp_layers,
          resmlp_dropout,
      )
  
file_path: pytext/pytext/models/embeddings/char_embedding.py
imports: import warnings
  from typing import List, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from pytext.config.field_config import CharFeatConfig
  from pytext.fields import FieldMeta
  from pytext.utils.usage import log_class_usage
  from pytorch.text.fb.nn.modules.cnn_char_embedding import CNNCharacterEmbedding
  from .embedding_base import EmbeddingBase
label_desc: Use image node_id 1 for calling the CharacterEmbedding obj's underlying member method code with example usage: obj.from_config(cls, config, metadata, vocab_size) and returns: cls