• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_CCSRC_FRONTEND_OPERATOR_CC_IMPLEMENTATIONS_H_
18 #define MINDSPORE_CCSRC_FRONTEND_OPERATOR_CC_IMPLEMENTATIONS_H_
19 
20 #include <vector>
21 #include <memory>
22 #include "ir/anf.h"
23 #include "ir/value.h"
24 #include "utils/any.h"
25 
26 namespace mindspore {
27 // namespace to support primitive operators definition
28 namespace prim {
29 using Any = mindspore::Any;
30 using AnyPtrList = std::vector<std::shared_ptr<Any>>;
31 using ValuePtrList = std::vector<ValuePtr>;
32 using OpsFunction = std::function<Any(const AnyPtrList &)>;
33 using AnfNodeOpsFunction = std::function<AnfNodePtr(const std::vector<AnfNodePtr> &)>;
34 
35 ValuePtr ScalarAdd(const ValuePtrList &list);
36 ValuePtr ScalarSub(const ValuePtrList &list);
37 ValuePtr ScalarMul(const ValuePtrList &list);
38 ValuePtr ScalarDiv(const ValuePtrList &list);
39 ValuePtr ScalarMod(const ValuePtrList &list);
40 ValuePtr ScalarPow(const ValuePtrList &list);
41 ValuePtr ScalarFloordiv(const ValuePtrList &list);
42 ValuePtr ScalarUAdd(const ValuePtrList &list);
43 ValuePtr ScalarUSub(const ValuePtrList &list);
44 ValuePtr ScalarLog(const ValuePtrList &list);
45 ValuePtr ScalarEq(const ValuePtrList &list);
46 ValuePtr ScalarLt(const ValuePtrList &list);
47 ValuePtr ScalarGt(const ValuePtrList &list);
48 ValuePtr ScalarNe(const ValuePtrList &list);
49 ValuePtr ScalarLe(const ValuePtrList &list);
50 ValuePtr ScalarGe(const ValuePtrList &list);
51 ValuePtr BoolNot(const ValuePtrList &list);
52 ValuePtr BoolAnd(const ValuePtrList &list);
53 ValuePtr BoolOr(const ValuePtrList &list);
54 ValuePtr BoolEq(const ValuePtrList &list);
55 }  // namespace prim
56 }  // namespace mindspore
57 
58 #endif  // MINDSPORE_CCSRC_FRONTEND_OPERATOR_CC_IMPLEMENTATIONS_H_
59