32constexpr uint32_t inputTensorIdx = 0;
33constexpr uint32_t weightTensorIdx = 1;
34constexpr uint32_t biasTensorIdx = 2;
41onert_micro::import::configure_kernel_CircleFullyConnected(
const OMConfigureArgs &config_args)
45 uint16_t op_index = config_args.kernel_index;
49 runtime_kernel.
readKernel(op_index, runtime_context);
51 const circle::Tensor *
input = runtime_kernel.
inputs[inputTensorIdx];
52 const circle::Tensor *weight = runtime_kernel.
inputs[weightTensorIdx];
53 const circle::Tensor *
bias = runtime_kernel.
inputs[biasTensorIdx];
56 assert(input !=
nullptr);
57 assert(weight !=
nullptr);
59 assert(output !=
nullptr);
64 if (weight->type() == circle::TensorType_FLOAT32)
67 status = utils::checkCondition(
input->type() == circle::TensorType_FLOAT32 and
68 output->type() == circle::TensorType_FLOAT32 and
69 (!bias or
bias->type() == circle::TensorType_FLOAT32));
75 if (weight->type() == circle::TensorType_UINT8)
78 status = utils::checkCondition(
input->type() == circle::TensorType_UINT8 and
79 output->type() == circle::TensorType_UINT8 and
80 (!bias or
bias->type() == circle::TensorType_INT32));
84 else if (weight->type() == circle::TensorType_INT8)
86 status = utils::checkCondition(
input->type() == circle::TensorType_INT8 or
87 input->type() == circle::TensorType_FLOAT32);
91 status = utils::checkCondition(
output->type() == circle::TensorType_INT8 or
92 output->type() == circle::TensorType_FLOAT32);
96 status = utils::checkCondition(!bias or
bias->type() == circle::TensorType_INT32 or
97 bias->type() == circle::TensorType_INT64 or
98 bias->type() == circle::TensorType_FLOAT32);
102 if (
input->type() == circle::TensorType_FLOAT32)
106 status = utils::checkCondition(weight->quantization() !=
nullptr and
107 weight->quantization()->scale() !=
nullptr);
112 else if (weight->type() == circle::TensorType_INT16)
115 status = utils::checkCondition(
input->type() == circle::TensorType_INT16 and
116 output->type() == circle::TensorType_INT16 and
117 (!bias or
bias->type() == circle::TensorType_INT32));
128 status = utils::checkCondition(weight_shape.dimensionsCount() == 2);
134#ifndef DIS_DYN_SHAPES
137 if (input_shape.flatSize() == 0)
144 status = utils::checkCondition(bias ==
nullptr or weight_shape.dims(0) == bias_shape.flatSize());
146 if (
input->type() == circle::TensorType_FLOAT32)
152 if (
input->quantization() ==
nullptr or
output->quantization() ==
nullptr or
153 weight->quantization() ==
nullptr)
156 if (
output->quantization()->scale() ==
nullptr or
output->quantization()->scale()->size() != 1)
159 if (
output->quantization()->zero_point() ==
nullptr or
160 output->quantization()->zero_point()->size() != 1)
163 if (weight->quantization()->scale() ==
nullptr or weight->quantization()->scale()->size() != 1)
166 if (weight->quantization()->zero_point() ==
nullptr or
167 weight->quantization()->zero_point()->size() != 1)
OMRuntimeShape getDynamicRuntimeShape(uint16_t tensor_index)
OMStatus readKernel(uint16_t op_index, core::OMRuntimeContext &runtime_context)
const circle::Tensor * outputs[maxOutputSize]
int32_t inputs_index[maxInputSize]
const circle::Tensor * inputs[maxInputSize]
const luci_interpreter::RuntimeShape output_shape
constexpr uint32_t outputTensorIdx
@ UnsupportedQuantizationType
@ UnsupportedDynamicShapeCase