class_docstr: A simple wrapper around the transformer encoder which adds a linear layer.
class_docstr_tok: ["A","simple","wrapper","around","the","transformer","encoder","which","adds","a","linear","layer","."]
code: def __init__(self, opt, dict, null_idx):
      super(CrossEncoderModule, self).__init__()
      embeddings = torch.nn.Embedding(
          len(dict), opt["embedding_size"], padding_idx=null_idx
      )
      torch.nn.init.normal_(
          embeddings.weight, 0, opt["embedding_size"] ** -0.5
      )
      self.encoder = TransformerEncoder(
          opt=opt,
          embedding=embeddings,
          vocabulary_size=len(dict),
          padding_idx=null_idx,
          reduction_type=opt.get("reduction_type", "first"),
          n_segments=2,
      )
      self.linear_layer = torch.nn.Linear(opt["embedding_size"], 1)
  
file_path: ParlAI/parlai/agents/transformer/crossencoder.py
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from .modules import TransformerEncoder
  from parlai.core.torch_ranker_agent import TorchRankerAgent
  from .transformer import TransformerRankerAgent
  from parlai.utils.torch import concat_without_padding
  import torch
label_desc: Use image node_id 1 to create a new CrossEncoderModule object from inherited base classes: torch.nn with example: obj = CrossEncoderModule(opt, dict, null_idx)