parameters: (tensor, numel_per_tensor)
return_statement: return output
docstring: Sum of each subtensor in a packed tensor with last_dim=1.
  
      Args:
          tensor (torch.Tensor): The input :ref:`packed_tensor<packed>`
          numel_per_tensor (torch.LongTensor):
              Tensor containing the number of element per sub-tensor.
  
      Returns:
          (torch.Tensor):
              A 1D tensor of size ``tensor.shape[0]``,
              containing the sum of each sub-tensor in the input tensor.
docstring_summary: Sum of each subtensor in a packed tensor with last_dim=1.
docstring_tokens: Sum of each subtensor in a packed tensor with last_dim = 1 .
function: def packed_simple_sum(tensor, numel_per_tensor):
      """Sum of each subtensor in a packed tensor with last_dim=1.
  
      Args:
          tensor (torch.Tensor): The input :ref:`packed_tensor<packed>`
          numel_per_tensor (torch.LongTensor):
              Tensor containing the number of element per sub-tensor.
  
      Returns:
          (torch.Tensor):
              A 1D tensor of size ``tensor.shape[0]``,
              containing the sum of each sub-tensor in the input tensor.
      """
      assert tensor.shape[-1] == 1
      if torch.cuda.is_available() and tensor.is_cuda and not numel_per_tensor.is_cuda:
          output = _PackedSimpleSumCuda.apply(tensor, numel_per_tensor)
      else:
          output = []
          last_id = 0
          for i, numel in enumerate(numel_per_tensor):
              first_id = last_id
              last_id += int(numel)
              output.append(torch.sum(tensor[first_id:last_id]))
          output = torch.stack(output, dim=0)
      return output
function_tokens: def packed_simple_sum ( tensor , numel_per_tensor ) : assert tensor . shape [ - 1 ] == 1 if torch . cuda . is_available ( ) and tensor . is_cuda and not numel_per_tensor . is_cuda : output = _PackedSimpleSumCuda . apply ( tensor , numel_per_tensor ) else : output = [ ] last_id = 0 for i , numel in enumerate ( numel_per_tensor ) : first_id = last_id last_id += int ( numel ) output . append ( torch . sum ( tensor [ first_id : last_id ] ) ) output = torch . stack ( output , dim = 0 ) return output