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))
101 status = utils::checkCondition(bias ==
nullptr or weight_shape.
dims(0) == bias_shape.
flatSize());
103 if (input->type() == circle::TensorType_FLOAT32)
106 auto input_quant = input->quantization();
107 auto filter_quant = weight->quantization();
108 auto output_quant = output->quantization();
110 status = utils::checkCondition(input_quant !=
nullptr and filter_quant !=
nullptr and
111 output_quant !=
nullptr);
118 auto input_scales = input_quant->scale();
119 auto filter_scales = filter_quant->scale();
120 auto output_scales = output_quant->scale();
122 status = utils::checkCondition(input_scales !=
nullptr and filter_scales !=
nullptr and
123 output_scales !=
nullptr);
131 status = utils::checkCondition(filter_scales->size() > 1);