parameters: (self, x, w)
return_statement: return xs
docstring: forward of embedding
          Args:
              x (CTensor): input tensor.
              w (CTensor): weight tensor.
          Returns:
              the output CTensor.
docstring_summary: forward of embedding
          Args:
              x (CTensor): input tensor.
              w (CTensor): weight tensor.
          Returns:
              the output CTensor.
docstring_tokens: forward of embedding Args : x ( CTensor ) : input tensor . w ( CTensor ) : weight tensor . Returns : the output CTensor .
function: def forward(self, x, w):
          """
          forward of embedding
          Args:
              x (CTensor): input tensor.
              w (CTensor): weight tensor.
          Returns:
              the output CTensor.
          """
          x = tensor.to_numpy(tensor.from_raw_tensor(x))
          if training:
              self.cache = (x, w.shape())
  
          xs = []
          x = x.tolist()
          for indice in x:
              sub_xs = []
              for idx in indice:
                  idx = int(idx)
                  tmp_tensor = singa.SliceOn(w, idx, idx + 1, 0)
                  sub_xs.append(tmp_tensor)
              sub_xs = singa.VecTensor(sub_xs)
              tmp_tensor = singa.ConcatOn(sub_xs, 0)
              tmp_tensor = singa.Reshape(tmp_tensor,
                                         [1] + list(tmp_tensor.shape()))
  
              xs.append(tmp_tensor)
          xs = singa.VecTensor(xs)
          xs = singa.ConcatOn(xs, 0)
          return xs
function_tokens: def forward ( self , x , w ) : x = tensor . to_numpy ( tensor . from_raw_tensor ( x ) ) if training : self . cache = ( x , w . shape ( ) ) xs = [ ] x = x . tolist ( ) for indice in x : sub_xs = [ ] for idx in indice : idx = int ( idx ) tmp_tensor = singa . SliceOn ( w , idx , idx + 1 , 0 ) sub_xs . append ( tmp_tensor ) sub_xs = singa . VecTensor ( sub_xs ) tmp_tensor = singa . ConcatOn ( sub_xs , 0 ) tmp_tensor = singa . Reshape ( tmp_tensor , [ 1 ] + list ( tmp_tensor . shape ( ) ) ) xs . append ( tmp_tensor ) xs = singa . VecTensor ( xs ) xs = singa . ConcatOn ( xs , 0 ) return xs