def METHOD_NAME(self, inputs, split_by_scaling_lengths, gc, dc):
    data, lengths = inputs
    len_len = len(lengths)
    def _find_factor_simple(x):
        for i in [2, 3, 5, 7, 9, 11]:
            if x % i == 0:
                return i
        return x
    num_output = _find_factor_simple(len_len)
    scaling_factor = 1
    if split_by_scaling_lengths:
        sum_len = sum(lengths)
        sum_scaling_lengths = _find_factor_simple(sum_len)
        if sum_scaling_lengths != sum_len and sum_scaling_lengths >= num_output:
            scaling_lengths = [1] * (num_output - 1) + [sum_scaling_lengths - num_output + 1]
            len_len = len(scaling_lengths)
            lengths = np.array(scaling_lengths, dtype=np.int32)
            scaling_factor = (sum_len // sum_scaling_lengths) if sum_scaling_lengths else 1
    axis = 0
    op = core.CreateOperator(
        "SplitByLengths",
        ["data", "lengths"],
        ['X_{}'.format(i) for i in range(num_output)],
        axis=axis,
        use_scaling_lengths=split_by_scaling_lengths,
    )
    def split_by_lengths_ref(data, lengths, num_output=num_output, axis=0):
        idxs = np.cumsum([0] + list(lengths)).astype(np.int32)
        return [
            np.array(
                data.take(
                    np.arange(
                        scaling_factor * idxs[i * len_len // num_output],
                        scaling_factor * idxs[(i + 1) * len_len // num_output]
                    ),
                    axis=axis
                )
            ) for i in range(num_output)
        ]
    outputs_with_grad = range(num_output)
    input_tensors = [data, lengths]
    self.assertReferenceChecks(
        hu.cpu_do, op, input_tensors, split_by_lengths_ref)
    self.assertDeviceChecks(dc, op, input_tensors, outputs_with_grad)
    self.assertGradientChecks(
        hu.cpu_do, op, input_tensors, 0, outputs_with_grad,
        input_device_options={"lengths": hu.cpu_do})