Split a dataset to multiple slices

How can I randomly split a data and target one to n slices in pytorch? Something similar to the following example in numpy:

I=15

split_points = np.random.choice(data.shape[0] - 2, I - 1, replace=False) + 1

split_points.sort()

data = np.split(data, split_points)

target= np.split(target, split_points)