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: Shifts the input tensor `x` to the right across the seq_len (second) dimension
      and returns [pad, x[..., :-1]]
  
  Args:
      x: tensor, expected shape [B, seq_length, hidden_dim]
      prefix: the tensor to prefix to `x` with  shape [B, 1, hidden_dim].
          If `prefix` is None, it is set to zeros.
  
  Returns:
      the input tensor `x` shifted to the right by one position and prefixed
      with the specified `prefix`; shape is the same as `x`
docstr_tok: ["Shifts","the","input","tensor","`","x","`","to","the","right","across","the","seq_len","(","second",")","dimension","and","returns","[","pad",",","x","[","...",",",":","-1","]","]","Args",":","x",":","tensor",",","expected","shape","[","B",",","seq_length",",","hidden_dim","]","prefix",":","the","tensor","to","prefix","to","`","x","`","with","shape","[","B",",","1",",","hidden_dim","]",".","If","`","prefix","`","is","None",",","it","is","set","to","zeros",".","Returns",":","the","input","tensor","`","x","`","shifted","to","the","right","by","one","position","and","prefixed","with","the","specified","`","prefix","`",";","shape","is","the","same","as","`","x","`"]
code: def _shift_to_the_right(
      x: Tensor, prefix: Optional[Tensor] = None
  ) -> Tensor:
      """
      Shifts the input tensor `x` to the right across the seq_len (second) dimension
          and returns [pad, x[..., :-1]]
  
      Args:
          x: tensor, expected shape [B, seq_length, hidden_dim]
          prefix: the tensor to prefix to `x` with  shape [B, 1, hidden_dim].
              If `prefix` is None, it is set to zeros.
  
      Returns:
          the input tensor `x` shifted to the right by one position and prefixed
          with the specified `prefix`; shape is the same as `x`
      """
      B, seq_len, hidden_dim = x.shape
      expected_prefix_shape = (B, 1, hidden_dim)
      if prefix is None:
          prefix = x.new_zeros(expected_prefix_shape)
      assert prefix.shape == expected_prefix_shape, "shape mismatch!"
      return torch.cat([prefix, x[:, :-1, :]], dim=1)
  
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 2 for calling the StartSym obj's underlying member method code with example usage: obj._shift_to_the_right(x, prefix) and returns: torch