class_docstr: Uses sine & cosine to represent position.  Concats the position and returns a larger object
  
  Default behavior is batch_first
class_docstr_tok: ["Uses","sine","&","cosine","to","represent","position",".","Concats","the","position","and","returns","a","larger","object","Default","behavior","is","batch_first"]
code: def forward(self, x):
      if len(x.shape) == 3:
          timing = self.encoding(
              torch.arange(x.shape[1], device=x.device)
          )
          timing = timing.expand(x.shape[0], -1, -1)
      else:
          timing = self.encoding(
              torch.arange(x.shape[0], device=x.device)
          )
  
      out = torch.cat((x, timing), dim=-1)
      return out
  
file_path: stanza/stanza/models/constituency/positional_encoding.py
imports: import math
  import torch
  from torch import nn
label_desc: Use image node_id 2 for calling the ConcatSinusoidalEncoding obj's underlying member method code with example usage: obj.forward(x) and returns: out