52 runtime_kernel.
readKernel(op_index, runtime_context);
54 const circle::Tensor *input = runtime_kernel.
inputs[inputTensorIdx];
55 const circle::Tensor *weight = runtime_kernel.
inputs[weightTensorIdx];
56 const circle::Tensor *bias = runtime_kernel.
inputs[biasTensorIdx];
58 const circle::Tensor *output = runtime_kernel.
outputs[outputTensorIdx];
60 assert(input !=
nullptr);
61 assert(weight !=
nullptr);
63 assert(output !=
nullptr);
67 if ((input->type() == circle::TensorType_FLOAT32 &&
68 weight->type() != circle::TensorType_FLOAT32) or
69 (input->type() == circle::TensorType_INT8 && weight->type() != circle::TensorType_INT8) or
70 (input->type() == circle::TensorType_INT16 && weight->type() != circle::TensorType_INT16))
92 status = utils::checkCondition(bias ==
nullptr or weight_shape.
dims(0) == bias_shape.
flatSize());
94 if (input->type() == circle::TensorType_FLOAT32)
97 auto input_quant = input->quantization();
98 auto filter_quant = weight->quantization();
99 auto output_quant = output->quantization();
101 status = utils::checkCondition(input_quant !=
nullptr and filter_quant !=
nullptr and
102 output_quant !=
nullptr);
106 auto input_scales = input_quant->scale();
107 auto filter_scales = filter_quant->scale();
108 auto output_scales = output_quant->scale();
110 status = utils::checkCondition(input_scales !=
nullptr and filter_scales !=
nullptr and
111 output_scales !=
nullptr);
116 status = utils::checkCondition(filter_scales->size() > 1);