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 tvm/relay/op/make_op.h |
23 | * \brief Header of internal operator functions |
24 | * to assist in creating ops in C++ |
25 | */ |
26 | #ifndef TVM_RELAY_OP_MAKE_OP_H_ |
27 | #define TVM_RELAY_OP_MAKE_OP_H_ |
28 | |
29 | #include <tvm/relay/expr.h> |
30 | #include <tvm/relay/op.h> |
31 | #include <tvm/tir/index_map.h> |
32 | |
33 | // Include Templated Make Functions |
34 | #include "nn/convolution_make.h" |
35 | #include "nn/pooling.h" |
36 | |
37 | namespace tvm { |
38 | namespace relay { |
39 | |
40 | Expr MakeBroadCastTo(Expr data, Array<Integer> shape); |
41 | |
42 | Expr MakeCast(Expr data, DataType dtype); |
43 | |
44 | Expr MakeClip(Expr a, double a_min, double a_max); |
45 | |
46 | Expr MakeConcatenate(Expr data, int axis); |
47 | |
48 | Expr MakeMatmul(Expr tensor_a, Expr tensor_b, IndexExpr units, DataType out_dtype, bool transpose_a, |
49 | bool transpose_b); |
50 | |
51 | Expr MakeDense(Expr data, Expr weight, IndexExpr units, DataType out_dtype); |
52 | |
53 | Expr MakeBatchMatmul(Expr lhs, Expr rhs, DataType out_dtype, bool transpose_a, bool transpose_b); |
54 | |
55 | Expr MakeExpandDims(Expr data, int axis, int num_newaxis); |
56 | |
57 | Expr MakeFixedPointMultiplyPerAxis(Expr x, Expr m, Expr lshift, Expr rshift, |
58 | bool is_lshift_required, bool is_rshift_required, |
59 | Array<Integer> axis); |
60 | |
61 | Expr MakeFull(Expr fill_value, Array<Integer> shape, DataType dtype); |
62 | |
63 | Expr MakeLayoutTransform(Expr data, String src_layout, String dst_layout); |
64 | |
65 | Expr MakeMetaScheduleLayoutTransform(Expr data, tir::IndexMap index_map); |
66 | |
67 | Expr MakeAutoSchedulerLayoutTransform(Expr data, String src_layout, String dst_layout); |
68 | |
69 | Expr MakeOnes(Array<Integer> shape, DataType dtype); |
70 | |
71 | Expr MakePad(Expr data, Array<Array<Integer>> pad_width, Expr pad_value, String pad_mode); |
72 | |
73 | Expr MakeReduce(Expr data, Array<Integer> axis, bool keepdims, bool exclude, String op_name); |
74 | |
75 | Expr MakeRepeat(Expr data, int repeats, int axis); |
76 | |
77 | Expr MakeReshape(Expr data, Array<Integer> newshape, bool allowzero = false); |
78 | |
79 | Expr MakeReshapeLike(Expr lhs, Expr rhs, int lhs_begin, Integer lhs_end, int rhs_begin, |
80 | Integer rhs_end); |
81 | |
82 | Expr MakeSplit(Expr data, ObjectRef indices_or_sections, int axis); |
83 | |
84 | Expr MakeSqueeze(Expr data, Array<Integer> axis); |
85 | |
86 | Expr MakeStack(Expr data, int axis); |
87 | |
88 | Expr MakeTranspose(Expr data, Array<Integer> axes); |
89 | |
90 | Expr MakeStridedSlice(Expr data, Array<Integer> begin, Array<Integer> end, Array<Integer> strides, |
91 | String slice_mode, |
92 | Optional<Array<Integer>> axes = NullValue<Array<Integer>>()); |
93 | |
94 | Expr MakeTile(Expr data, Array<Integer> reps); |
95 | |
96 | Expr MakeTopK(Expr data, int k, int axis, String ret_type, bool is_ascend, DataType dtype); |
97 | |
98 | Expr MakeUpSampling(Expr data, double scale_h, double scale_w, String layout, String method, |
99 | bool align_corners); |
100 | |
101 | Expr MakeUpSampling3D(Expr data, double scale_d, double scale_h, double scale_w, String layout, |
102 | String method, String coordinate_transformation_mode); |
103 | |
104 | Expr MakeVariance(Expr data, Expr mean, Array<Integer> axis, bool keepdims, bool exclude, |
105 | bool unbiased); |
106 | |
107 | Expr MakeZeros(Array<Integer> shape, DataType dtype); |
108 | |
109 | Expr MakeOneHot(Expr indices, Expr on_value, Expr off_value, int depth, int axis, DataType dtype); |
110 | |
111 | Expr MakeResize2D(Expr data, Array<IndexExpr> size, Array<FloatImm> roi, String layout, |
112 | String method, String coordinate_transformation_mode, String rounding_method, |
113 | double cubic_alpha, int cubic_exclude, double , |
114 | DataType out_dtype); |
115 | |
116 | Expr MakeSparseToDense(Expr indices, Array<Integer> output_shape, Expr values, Expr default_value); |
117 | |
118 | Expr MakeArange(Expr start, Expr stop, Expr step, DataType dtype); |
119 | |
120 | Expr MakeShapeOf(Expr data, DataType dtype); |
121 | |
122 | Expr MakeTake(Expr data, Expr indices, Integer batch_dims, Integer axis, String mode); |
123 | |
124 | Expr MakeBiasAdd(Expr data, Expr bias, int axis); |
125 | |
126 | } // namespace relay |
127 | } // namespace tvm |
128 | #endif // TVM_RELAY_OP_MAKE_OP_H_ |
129 | |