


transformer_encoder = nn.TransformerEncoder(encoder_layer, num_layers=6)
      >>> src = torch.rand(10, 32, 512)
      >>> out = transformer_encoder(src)



forward(src, mask=None, src_key_padding_mask=None, is_causal=None)
  Pass the input through the encoder layers in turn.

  Parameters:
     * **src** (*Tensor*) -- the sequence to the encoder
       (required).

     * **mask** (*Optional**[**Tensor**]*) -- the mask for the src
       sequence (optional).

     * **is_causal** (*Optional**[**bool**]*) -- If specified,
       applies a causal mask as mask (optional) and ignores
       attn_mask for computing scaled dot product attention.
       Default: "False".

     * **src_key_padding_mask** (*Optional**[**Tensor**]*) -- the
       mask for the src keys per batch (optional).

  Return type:
     *Tensor*

  Shape:
     see the docs in Transformer class.
