class_docstr: Streaming Positional encoding.
  
  Args:
      d_model (int): Embedding dimension.
      dropout_rate (float): Dropout rate.
      max_len (int): Maximum input length.
class_docstr_tok: ["Streaming","Positional","encoding",".","Args",":","d_model","(","int",")",":","Embedding","dimension",".","dropout_rate","(","float",")",":","Dropout","rate",".","max_len","(","int",")",":","Maximum","input","length","."]
docstr: Construct an PositionalEncoding object.
docstr_tok: ["Construct","an","PositionalEncoding","object","."]
code: def __init__(self, d_model, dropout_rate, max_len=5000):
      """Construct an PositionalEncoding object."""
      super(StreamPositionalEncoding, self).__init__()
      self.d_model = d_model
      self.xscale = math.sqrt(self.d_model)
      self.dropout = torch.nn.Dropout(p=dropout_rate)
      self.pe = None
      self.tmp = torch.tensor(0.0).expand(1, max_len)
      self.extend_pe(self.tmp.size(1), self.tmp.device, self.tmp.dtype)
      self._register_load_state_dict_pre_hook(_pre_hook)
  
imports: import math
  import torch
label_desc: Use image node_id 1 to create a new StreamPositionalEncoding object from inherited base classes: torch.nn with example: obj = StreamPositionalEncoding(d_model, dropout_rate, max_len)