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 * \brief Tag definitions
22 * \file tags.h
23 */
24#ifndef TVM_TOPI_TAGS_H_
25#define TVM_TOPI_TAGS_H_
26
27#include <string>
28
29namespace tvm {
30namespace topi {
31
32constexpr auto kElementWise = "elemwise";
33constexpr auto kInjective = "injective";
34constexpr auto kCommReduce = "comm_reduce";
35constexpr auto kCommReduceIdx = "comm_reduce_idx";
36constexpr auto kBroadcast = "broadcast";
37constexpr auto kMatMul = "matmul";
38constexpr auto kConv2dNCHW = "conv2d_nchw";
39constexpr auto kConv2dHWCN = "conv2d_hwcn";
40constexpr auto kDepthwiseConv2dNCHW = "depthwise_conv2d_nchw";
41constexpr auto kDepthwiseConv2dNHWC = "depthwise_conv2d_nhwc";
42constexpr auto kDepthwiseConv2dBackInputNHWC = "depthwise_conv2d_back_input_nhwc";
43constexpr auto kDepthwiseConv2dBackWeightNHWC = "depthwise_conv2d_back_weight_nhwc";
44constexpr auto kEinsum = "einsum";
45constexpr auto kGroupConv2d = "group_conv2d";
46
47inline bool is_broadcast(std::string tag) {
48 return tag.rfind(kElementWise, 0) == 0 || tag.rfind(kBroadcast, 0) == 0;
49}
50
51inline bool is_injective(std::string tag) {
52 return tag.rfind(kElementWise, 0) == 0 || tag.rfind(kBroadcast, 0) == 0 ||
53 tag.rfind(kInjective, 0) == 0;
54}
55
56} // namespace topi
57} // namespace tvm
58
59#endif // TVM_TOPI_TAGS_H_
60