MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Run

Method Run

tensorflow/lite/toco/graph_transformations/dequantize.cc:189–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187} // namespace
188
189::tensorflow::Status Dequantize::Run(Model* model, std::size_t op_index,
190 bool* modified) {
191 *modified = false;
192 const auto op_it = model->operators.begin() + op_index;
193 auto* op = op_it->get();
194
195 if (op->type == OperatorType::kDequantize) {
196 auto& input_array = model->GetArray(op->inputs[0]);
197 if (input_array.data_type == ArrayDataType::kFloat) {
198 return ::tensorflow::Status::OK();
199 }
200 if (input_array.final_data_type != ArrayDataType::kFloat) {
201 return ::tensorflow::Status::OK();
202 }
203 input_array.data_type = ArrayDataType::kFloat;
204 input_array.quantization_params = nullptr;
205 auto& output_array = model->GetArray(op->outputs[0]);
206 output_array.data_type = ArrayDataType::kFloat;
207 output_array.quantization_params = nullptr;
208 *modified = RemoveTrivialPassthroughOp(this, model, op_index);
209 return ::tensorflow::Status::OK();
210 }
211
212 std::vector<string> arrays;
213 for (const string& input : op->inputs) {
214 arrays.push_back(input);
215 }
216 for (const string& output : op->outputs) {
217 arrays.push_back(output);
218 }
219 bool changed = false;
220 for (const string& array : arrays) {
221 if (!model->IsOptionalArray(array)) {
222 changed |= DequantizeArray(array, this, model);
223 }
224 }
225
226 *modified = changed;
227 return ::tensorflow::Status::OK();
228}
229
230} // namespace toco

Callers

nothing calls this directly

Calls 6

DequantizeArrayFunction · 0.85
IsOptionalArrayMethod · 0.80
beginMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected