docstr: Given:
    data[M1 x M2 x ... x Md]
                    the input data
    indices[N]      the index of each entry of segment_ids into data,
                    where 0 <= index[i] < M1,
                    with default indices=[0,1,...N]
    segment_ids[N]  the segment_id for each entry of indices,
  
  returns K outputs, each one containing data entries corresponding
  to one of the segments present in `segment_ids`.
docstr_tok: ["Given",":","data","[","M1","x","M2","x","...","x","Md","]","the","input","data","indices","[","N","]","the","index","of","each","entry","of","segment_ids","into","data",",","where","0","<","=","index","[","i","]","<","M1",",","with","default","indices=","[","0,1",",","...","N","]","segment_ids","[","N","]","the","segment_id","for","each","entry","of","indices",",","returns","K","outputs",",","each","one","containing","data","entries","corresponding","to","one","of","the","segments","present","in","`","segment_ids","`","."]
code: def split(self, data, segment_ids, indices=None):
      """
      Given:
        data[M1 x M2 x ... x Md]
                        the input data
        indices[N]      the index of each entry of segment_ids into data,
                        where 0 <= index[i] < M1,
                        with default indices=[0,1,...N]
        segment_ids[N]  the segment_id for each entry of indices,
  
      returns K outputs, each one containing data entries corresponding
      to one of the segments present in `segment_ids`.
      """
      if segment_ids.size == 0:
          return []
      K = max(segment_ids) + 1
      outputs = [
          np.zeros(
              (np.count_nonzero(segment_ids == seg_id),)
              + data.shape[1:],
              dtype=data.dtype,
          )
          for seg_id in range(0, K)
      ]
      counts = np.zeros(K, dtype=int)
      for i, seg_id in enumerate(segment_ids):
          data_idx = i if indices is None else indices[i]
          outputs[seg_id][counts[seg_id]] = data[data_idx]
          counts[seg_id] += 1
      return outputs
  
imports: from functools import partial
  from hypothesis import given, settings
  import numpy
  import unittest
  import hypothesis.strategies
  from caffe2.python import core, workspace
  import caffe2.python.hypothesis_test_util
  import caffe2.python.serialized_test.serialized_test_util
label_desc: Use image node_id 1 for calling the SegmentsTester obj's underlying member method code with example usage: obj.split(data, segment_ids, indices) and returns: outputs, list