My Project
UniformConstraints.h
Go to the documentation of this file.
1 //===- UniformConstraints.h - Constraints for uniform quant -----*- C++ -*-===//
2 //
3 // Part of the MLIR Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a builder that lets you attach constraints necessary to
10 // perform a variety of uniform quantization conversions to CAG anchors.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_QUANTIZER_SUPPORT_UNIFORMCONSTRAINTS_H
15 #define MLIR_QUANTIZER_SUPPORT_UNIFORMCONSTRAINTS_H
16 
18 
19 namespace mlir {
20 namespace quantizer {
21 
22 class CAGAnchorNode;
23 class CAGSlice;
24 
28 public:
29  UniformConstraintsBuilder(CAGSlice &slice) : slice(slice) {}
30 
34 
38 
43  void clamp(CAGAnchorNode *a, APFloat minValue, APFloat maxValue);
44 
52 
53 private:
54  CAGSlice &slice;
55 };
56 
57 } // namespace quantizer
58 } // namespace mlir
59 
60 #endif // MLIR_QUANTIZER_SUPPORT_UNIFORMCONSTRAINTS_H
Definition: InferTypeOpInterface.cpp:20
Definition: UniformConstraints.h:27
void propagateExplicitScale(CAGAnchorNode *from, CAGAnchorNode *to)
Definition: UniformConstraints.cpp:253
Statistics about a tensor axis (or the whole tensor).
Definition: Statistics.h:23
A slice of a CAG (which may be the whole graph).
Definition: ConstraintAnalysisGraph.h:245
void applyStats(CAGAnchorNode *a, TensorAxisStatistics stats)
Definition: UniformConstraints.cpp:240
Definition: ConstraintAnalysisGraph.h:132
void coupleAnchors(CAGAnchorNode *a, CAGAnchorNode *b)
Definition: UniformConstraints.cpp:235
void clamp(CAGAnchorNode *a, APFloat minValue, APFloat maxValue)
Definition: UniformConstraints.cpp:246
UniformConstraintsBuilder(CAGSlice &slice)
Definition: UniformConstraints.h:29