class_docstr: Compute positional encoding
class_docstr_tok: ["Compute","positional","encoding"]
docstr: Forward pass
  
  Args:
  ----
      x: embeddings (batch, max_len, d_model)
      **kwargs: additional arguments
  
  Returns
  -------
      positional embeddings (batch, max_len, d_model)
docstr_tok: ["Forward","pass","Args",":","--","--","x",":","embeddings","(","batch",",","max_len",",","d_model",")","*","*","kwargs",":","additional","arguments","Returns","--","--","--","-","positional","embeddings","(","batch",",","max_len",",","d_model",")"]
code: def call(
      self,
      x: tf.Tensor,
      **kwargs: Any,
  ) -> tf.Tensor:
      """Forward pass
  
      Args:
      ----
          x: embeddings (batch, max_len, d_model)
          **kwargs: additional arguments
  
      Returns
      -------
          positional embeddings (batch, max_len, d_model)
      """
      if x.dtype == tf.float16:  # amp fix: cast to half
          x = x + tf.cast(self.pe[:, : x.shape[1]], dtype=tf.half)
      else:
          x = x + self.pe[:, : x.shape[1]]
      return self.dropout(x, **kwargs)
  
imports: import math
  from typing import Any, Callable, Optional, Tuple
  import tensorflow
  from tensorflow.keras import layers
  from doctr.utils.repr import NestedObject
label_desc: Use image node_id 2 for calling the PositionalEncoding obj's underlying member method code with example usage: obj.call(x) and returns: self