27void splitImpl(
const circle::Operator *cur_op,
const circle::Tensor *input,
int axis_value,
30 const int output_count = cur_op->outputs()->size();
32 const auto output0_index = cur_op->outputs()->operator[](0);
33 assert(output0_index != -1);
36 assert(output0 !=
nullptr);
38 const int split_dimensions = Tensor::num_dims(input);
40 assert(axis_value < split_dimensions);
41 assert(Tensor::num_dims(output0) == split_dimensions);
43 int64_t outer_size = 1;
44 for (
int i = 0; i < axis_value; ++i)
49 int64_t base_inner_size = 1;
50 for (
int i = axis_value + 1; i < split_dimensions; ++i)
55 const T *input_ptr = kernels::getTensorData<T>(runtime_graph->
getDataByTensor(input));
56 assert(input_ptr !=
nullptr);
57 for (
int k = 0; k < outer_size; ++k)
59 for (
int i = 0; i < output_count; ++i)
61 const auto output_index = cur_op->outputs()->operator[](i);
62 assert(output_index != -1);
65 assert(output !=
nullptr);
67 T *output_data = kernels::getTensorData<T>(runtime_graph->
getDataByTensor(output));
68 assert(output_data !=
nullptr);
69 const int copy_size =
Tensor::dim(output, axis_value) * base_inner_size;
70 T *output_ptr = output_data + k * copy_size;
71 assert(output_ptr !=
nullptr);
72 for (
int j = 0; j < copy_size; ++j)
73 output_ptr[j] = input_ptr[j];
74 input_ptr += copy_size;