


out = encoder_layer(src)



Alternatively, when "batch_first" is "True":
      >>> encoder_layer = nn.TransformerEncoderLayer(d_model=512, nhead=8, batch_first=True)
      >>> src = torch.rand(32, 10, 512)
      >>> out = encoder_layer(src)
Fast path:
      forward() will use a special optimized implementation if all of
      the following conditions are met:
  * Either autograd is disabled (using "torch.inference_mode" or
    "torch.no_grad") or no tensor argument "requires_grad"

  * training is disabled (using ".eval()")

  * batch_first is "True" and the input is batched (i.e.,
    "src.dim() == 3")

  * activation is one of: ""relu"", ""gelu"",
    "torch.functional.relu", or "torch.functional.gelu"

  * at most one of "src_mask" and "src_key_padding_mask" is passed

  * if src is a NestedTensor, neither "src_mask" nor
    "src_key_padding_mask" is passed

  * the two "LayerNorm" instances have a consistent "eps" value
