39constexpr uint32_t input3TensorIdx = 2;
44 int32_t *begins, int32_t *sizes)
46 int offset = MAX_DIM - dimensions;
47 for (
int idx = 0; idx < dimensions; ++idx)
49 begins[
offset + idx] = begin_data[idx];
50 sizes[
offset + idx] = size_data[idx];
63 const circle::Tensor *input1 =
nullptr;
64 const circle::Tensor *input2 =
nullptr;
65 const circle::Tensor *input3 =
nullptr;
67 const circle::Tensor *
output =
nullptr;
75 const circle::SliceOptions *
options;
79 runtime_kernel.
readKernel(op_index, runtime_context);
83 input3 = runtime_kernel.
inputs[input3TensorIdx];
86 assert(input1 !=
nullptr);
87 assert(input2 !=
nullptr);
88 assert(input3 !=
nullptr);
89 assert(output !=
nullptr);
91 status = runtime_kernel.
getDataFromStorage(op_index, runtime_storage, runtime_context);
100 assert(input1_data !=
nullptr);
101 assert(input2_data !=
nullptr);
102 assert(input3_data !=
nullptr);
103 assert(output_data !=
nullptr);
112 op_params.size_count = MAX_DIM;
113 for (
int i = 0; i < MAX_DIM; i++)
115 op_params.begin[i] = 0;
116 op_params.size[i] = 1;
118 auto num_dim = input_shape.dimensionsCount();
122 switch (input1->type())
125 case circle::TensorType_FLOAT32:
127 status =
pal::Slice(op_params, input_shape, utils::castInputData<float>(input1_data),
128 utils::castOutputData<float>(output_data));
132 case circle::TensorType_INT32:
134 status =
pal::Slice(op_params, input_shape, utils::castInputData<int32_t>(input1_data),
135 utils::castOutputData<int32_t>(output_data));
138 case circle::TensorType_INT64:
140 status =
pal::Slice(op_params, input_shape, utils::castInputData<int64_t>(input1_data),
141 utils::castOutputData<int64_t>(output_data));
147 assert(
false &&
"Unsupported type.");
uint8_t * outputs_data[maxOutputSize]
const circle::Operator * first_operator
OMStatus getDataFromStorage(uint16_t op_index, core::OMRuntimeStorage &storage, core::OMRuntimeContext &context)
uint8_t * inputs_data[maxInputSize]
OMStatus readKernel(uint16_t op_index, core::OMRuntimeContext &runtime_context)
const circle::Tensor * outputs[maxOutputSize]
const circle::Tensor * inputs[maxInputSize]
__global uchar * offset(const Image *img, int x, int y)
constexpr uint32_t input1TensorIdx
constexpr uint32_t outputTensorIdx
constexpr uint32_t input2TensorIdx
void getBeginAndSizeVectors(int dimensions, const Tensor *begin, const Tensor *size, std::vector< int > *begins, std::vector< int > *sizes)
const std::vector< float > input1_data
const std::vector< float > input2_data
const std::vector< float > input3_data
OMStatus Slice(const core::SliceParams &op_params, const core::OMRuntimeShape &input_shape, const T *input_data, T *output_data)
core::OMRuntimeContext & runtime_context
core::OMRuntimeStorage & runtime_storage