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 Registration of reduction operators
22 * \file reduction.cc
23 */
24#include <tvm/runtime/packed_func.h>
25#include <tvm/runtime/registry.h>
26#include <tvm/topi/reduction.h>
27#include <tvm/topi/utils.h>
28
29namespace tvm {
30namespace topi {
31
32using namespace tvm;
33using namespace tvm::runtime;
34
35TVM_REGISTER_GLOBAL("topi.sum").set_body([](TVMArgs args, TVMRetValue* rv) {
36 *rv = topi::sum(args[0], ArrayOrInt(args[1]), args[2]);
37});
38
39TVM_REGISTER_GLOBAL("topi.min").set_body([](TVMArgs args, TVMRetValue* rv) {
40 *rv = topi::min(args[0], ArrayOrInt(args[1]), args[2]);
41});
42
43TVM_REGISTER_GLOBAL("topi.max").set_body([](TVMArgs args, TVMRetValue* rv) {
44 *rv = topi::max(args[0], ArrayOrInt(args[1]), args[2]);
45});
46
47TVM_REGISTER_GLOBAL("topi.argmin").set_body([](TVMArgs args, TVMRetValue* rv) {
48 *rv = topi::argmin(args[0], ArrayOrInt(args[1]), args[2], false, args[3]);
49});
50
51TVM_REGISTER_GLOBAL("topi.argmax").set_body([](TVMArgs args, TVMRetValue* rv) {
52 *rv = topi::argmax(args[0], ArrayOrInt(args[1]), args[2], false, args[3]);
53});
54
55TVM_REGISTER_GLOBAL("topi.prod").set_body([](TVMArgs args, TVMRetValue* rv) {
56 *rv = topi::prod(args[0], ArrayOrInt(args[1]), args[2]);
57});
58
59TVM_REGISTER_GLOBAL("topi.all").set_body([](TVMArgs args, TVMRetValue* rv) {
60 *rv = topi::all(args[0], ArrayOrInt(args[1]), args[2]);
61});
62
63TVM_REGISTER_GLOBAL("topi.any").set_body([](TVMArgs args, TVMRetValue* rv) {
64 *rv = topi::any(args[0], ArrayOrInt(args[1]), args[2]);
65});
66
67} // namespace topi
68} // namespace tvm
69