class_docstr: Multi-head attention + FC + Layer-norm + Dropout.
  
  Similar to PyTorch's ``nn.TransformerEncoderLayer`` but supports :class:`RelativePositionSelfAttention`.
  
  Parameters
  ----------
  embed_dim
      Embedding dimension.
  num_heads
      Number of attention heads.
  mlp_ratio
      Ratio of MLP hidden dim to embedding dim.
  drop_path
      Drop path rate.
  drop_rate
      Dropout rate.
  pre_norm
      Whether to apply layer norm before attention.
  **kwargs
      Other arguments for :class:`RelativePositionSelfAttention`.
code: def maybe_layer_norm(self, layer_norm, x, before=False, after=False):
      assert before ^ after
      if after ^ self.normalize_before:
          return layer_norm(x)
      else:
          return x
  
imports: from __future__ import annotations
  from typing import Tuple, cast, Any, Dict
  import torch
  import torch.nn
  import torch.nn.functional
  import nni
  from nni.mutable import Categorical, MutableExpression, frozen_context, ensure_frozen, Mutable
  from nni.nas.nn.pytorch import ParametrizedModule, ModelSpace, MutableModule, Repeat, MutableConv2d, MutableLinear, MutableLayerNorm
  from nni.nas.space import current_model
  from nni.nas.oneshot.pytorch.supermodule.operation import MixedOperation
  from nni.nas.profiler.pytorch.flops import FlopsResult
  from nni.nas.profiler.pytorch.utils import MutableShape, ShapeTensor, profiler_leaf_module
  from .utils.pretrained import load_pretrained_weight
  from .utils.nn import DropPath
label_desc: Use image node_id 2 for calling the TransformerEncoderLayer obj's underlying member method code with example usage: obj.maybe_layer_norm(layer_norm, x, before, after) and returns: layer_norm, x