class_docstr: Layer scale from [Touvron et al 2021] (https://arxiv.org/pdf/2103.17239.pdf).
  This rescales diagonally the residual outputs close to 0, with a learnt scale.
  
  Args:
      channels (int): Number of channels.
      init (float): Initial scale.
      channel_last (bool): If True, expect `[*, C]` shaped tensors, otherwise, `[*, C, T]`.
      device (torch.device or str, optional): Device on which to initialize the module.
      dtype (torch.dtype, optional): dtype to use to initialize the module.
code: def __init__(
      self,
      channels: int,
      init: float = 1e-4,
      channel_last: bool = True,
      device=None,
      dtype=None,
  ):
      super().__init__()
      self.channel_last = channel_last
      self.scale = nn.Parameter(
          torch.full(
              (channels,),
              init,
              requires_grad=True,
              device=device,
              dtype=dtype,
          )
      )
  
imports: import typing
  from einops import rearrange
  import torch
  import torch.nn
  from torch.nn import functional
  from torch.utils.checkpoint import checkpoint
  from xformers import ops
  from .rope import RotaryEmbedding
  from .streaming import StreamingModule
label_desc: Use image node_id 1 to create a new LayerScale object from inherited base classes: nn with example: obj = LayerScale(channels, init, channel_last, device, dtype)