class_docstr: Helper to learn a "zero" symbol, i.e., the first symbol to feed.
class_docstr_tok: ["Helper","to","learn","a","``","zero","''","symbol",",","i.e.",",","the","first","symbol","to","feed","."]
docstr: Prefixes an input tensor with the learned start symbol. In other words, the
      first symbol in the sequence will be substituted by the learnt symbol.
  
  Args:
      x: tensor to prefix, expected shape is [B, seq_len, hidden_dim]
  
  Returns:
      a tensor prefixed with the learned start symbol, i.e. learnt symbol is the
          0th symbol in the sequence.
docstr_tok: ["Prefixes","an","input","tensor","with","the","learned","start","symbol",".","In","other","words",",","the","first","symbol","in","the","sequence","will","be","substituted","by","the","learnt","symbol",".","Args",":","x",":","tensor","to","prefix",",","expected","shape","is","[","B",",","seq_len",",","hidden_dim","]","Returns",":","a","tensor","prefixed","with","the","learned","start","symbol",",","i.e",".","learnt","symbol","is","the","0th","symbol","in","the","sequence","."]
code: def forward(self, x: Tensor) -> Tensor:
      """
      Prefixes an input tensor with the learned start symbol. In other words, the
          first symbol in the sequence will be substituted by the learnt symbol.
  
      Args:
          x: tensor to prefix, expected shape is [B, seq_len, hidden_dim]
  
      Returns:
          a tensor prefixed with the learned start symbol, i.e. learnt symbol is the
              0th symbol in the sequence.
      """
      B, seq_len, hidden_dim = x.shape
      # [hidden_dim] * [1, hidden_dim]
      prefix = self.sym * x.new_ones(
          B, 1, hidden_dim
      )  # [B, 1, hidden_dim]
      return self._shift_to_the_right(x, prefix)
  
imports: from functools import partial
  from typing import Callable, Optional
  import torch
  import torch.nn
  from torch import Tensor
  from .layers_utils import MLP, StochasticDepth, WindowMultiHeadAttention
label_desc: Use image node_id 3 for calling the StartSym obj's underlying member method code with example usage: obj.forward(x) and returns: self