static_range_ptq.cc
imports xla/tsl/platform/statusor.hStructured object names a sequence field
SHA-256ad28fe54b7ab50b931a16cf427be60e0c70b6b87e9f286637c07ad2983c48752
MaleculeH(Db)Md(In)
Evidence
1/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is …
11:42… IND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/static_range_ptq.h"
16
17#include <memory>
18#include <string>
19#include <unordered_set>
20#include <utility>
21#include <vector>
22
23#include "absl/base/nullability.h"
24#include "absl/container/flat_hash_map.h"
25#include "absl/log/log.h"
26#include "absl/status/status.h"
27#include "absl/status/statusor.h"
28#include "absl/strings/str_cat.h"
29#include "absl/strings/string_view.h"
30#include "mlir/IR/BuiltinOps.h" // from @llvm-project
31#include "mlir/IR/MLIRContext.h" // from @llvm-project
32#include "mlir/IR/OwningOpRef.h" // from @llvm-project
33#include "mlir/Pass/PassManager.h" // from @llvm-project
34#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/calibration/component.h"
35#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/component.h"
36#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/context.h"
37#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/post_calibration.h"
38#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/pre_calibration.h"
39#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/saved_model_export.h"
40#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/saved_model_import.h"
41#include "tensorflow/compiler/mlir/quantization/stablehlo/cc/types.h"
42#include "tensorflow/compiler/mlir/quantization/stablehlo/quantization_config.pb.h"
43#include "tensorflow/compiler/mlir/quantization/tensorflow/exported_model.pb.h"
44#include "tensorflow/compiler/mlir/quantization/tensorflow/python/py_function_lib.h"
45#include "tensorflow/compiler/mlir/quantization/tensorflow/quantization_options.pb.h"
46#include "xla/tsl/platform/statusor.h"
47#include "tensorflow/core/framework/function.pb.h"
48#include "tensorflow/core/protobuf/meta_graph.pb.h"
49#include "tensorflow/core/protobuf/saver.pb.h"
50
51namespace mlir::quant::stablehlo {
52
53using ::stablehlo::quantization::QuantizationConfig;
54usi …
77:25… const QuantizationConfig& config) {
78 // Runs sub-components in sequence: PreCalibrationComponent ->
79 // CalibrationComponent -> PostCalibrationComponents.
80 for (std::unique_ptr<Component>& sub_compo …