1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20/*!
21 *
22 * \file realize.h
23 *
24 * \brief Header of definitions for op realizations
25 *
26 */
27#ifndef TVM_RELAY_QUANTIZE_REALIZE_H_
28#define TVM_RELAY_QUANTIZE_REALIZE_H_
29
30#include <tvm/relay/transform.h>
31
32namespace tvm {
33namespace relay {
34namespace quantize {
35
36class QRealizeExprNode : public TempExprNode {
37 public:
38 Expr data;
39 static constexpr const char* _type_key = "relay.quantize.QRealizeExpr";
40 TVM_DECLARE_BASE_OBJECT_INFO(QRealizeExprNode, TempExprNode);
41};
42
43class QRealizeExpr : public TempExpr {
44 public:
45 TVM_DEFINE_OBJECT_REF_METHODS(QRealizeExpr, TempExpr, QRealizeExprNode);
46};
47
48class QRealizeIntExprNode : public QRealizeExprNode {
49 public:
50 Expr dom_scale;
51 DataType dtype;
52
53 void VisitAttrs(tvm::AttrVisitor* v) {
54 v->Visit("data", &data);
55 v->Visit("dom_scale", &dom_scale);
56 v->Visit("dtype", &dtype);
57 }
58
59 Expr Realize() const final;
60
61 static constexpr const char* _type_key = "relay.quantize.QRealizeIntExpr";
62 TVM_DECLARE_FINAL_OBJECT_INFO(QRealizeIntExprNode, QRealizeExprNode);
63};
64
65class QRealizeIntExpr : public QRealizeExpr {
66 public:
67 TVM_DLL QRealizeIntExpr(Expr data, Expr dom_scale, DataType dtype);
68
69 TVM_DEFINE_OBJECT_REF_METHODS(QRealizeIntExpr, QRealizeExpr, QRealizeIntExprNode);
70};
71
72} // namespace quantize
73} // namespace relay
74} // namespace tvm
75#endif // TVM_RELAY_QUANTIZE_REALIZE_H_
76