code: def unsorted_segment_sum(
      data: torch.Tensor,
      segment_ids: torch.Tensor,
      num_segments: Union[int, torch.Tensor],
  ) -> torch.Tensor:
      # Used the same check which is used for unsorted_segment_min as the
      # check should be same
      # Might require to change the assertion function name to
      # check_unsorted_segment_valid_params
      ivy.utils.assertions.check_unsorted_segment_valid_params(
          data, segment_ids, num_segments
      )
  
      res = torch.zeros(
          (num_segments,) + data.shape[1:],
          dtype=data.dtype,
          device=data.device,
      )
  
      for i in range(num_segments):
          mask_index = segment_ids == i
          if torch.any(mask_index):
              res[i] = torch.sum(data[mask_index], dim=0)
  
      return res
  
file_path: ivy/ivy/functional/backends/torch/experimental/creation.py
imports: from typing import Optional, Tuple, Union
  import math
  import torch
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes, with_unsupported_device_and_dtypes
  from ..None import backend_version
label_desc: Use image node_id 8 for calling a global function with example usage: unsorted_segment_sum(data, segment_ids, num_segments) and returns: res