class_docstr: <a id="EmbeddingsWithPositionalEncoding"></a>
  
  ## Embed tokens and add [fixed positional encoding](positional_encoding.html)
code: def forward(self, x: torch.Tensor):
      pe = self.positional_encodings[: x.shape[0]].requires_grad_(False)
      return self.linear(x) * math.sqrt(self.d_model) + pe
  
imports: import math
  import torch
  import torch.nn
  from labml_nn.utils import clone_module_list
  from .feed_forward import FeedForward
  from .mha import MultiHeadAttention
  from .positional_encoding import get_positional_encoding
label_desc: Use image node_id 2 for calling the EmbeddingsWithPositionalEncoding obj's underlying member method code with example usage: obj.forward(x) and returns: unknown