Assumes that the operators in the model have been topologically sorted.
| 640 | |
| 641 | // Assumes that the operators in the model have been topologically sorted. |
| 642 | TfLiteStatus QuantizeModel(flatbuffers::FlatBufferBuilder* builder, |
| 643 | ModelT* model, const TensorType& input_type, |
| 644 | const TensorType& output_type, bool allow_float, |
| 645 | ErrorReporter* error_reporter) { |
| 646 | TF_LITE_ENSURE_STATUS( |
| 647 | QuantizeWeightsInputOutput(model, allow_float, error_reporter)); |
| 648 | TF_LITE_ENSURE_STATUS(ApplyConstraints(model, error_reporter)); |
| 649 | TF_LITE_ENSURE_STATUS(QuantizeBiases(model, error_reporter)); |
| 650 | utils::SetOperatorCodeVersion(model); |
| 651 | TF_LITE_ENSURE_STATUS( |
| 652 | SetInputAndOutputTypes(model, input_type, output_type, error_reporter)); |
| 653 | |
| 654 | flatbuffers::Offset<Model> output_model_location = |
| 655 | Model::Pack(*builder, model); |
| 656 | FinishModelBuffer(*builder, output_model_location); |
| 657 | |
| 658 | return kTfLiteOk; |
| 659 | } |
| 660 | |
| 661 | TfLiteStatus QuantizeModel(flatbuffers::FlatBufferBuilder* builder, |
| 662 | ModelT* model, const TensorType& input_type, |