• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This is the C++ adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).
3  *
4  * Copyright 2019-2021 Huawei Technologies Co., Ltd
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * 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, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef MINDSPORE_CCSRC_FRONTEND_OPERATOR_COMPOSITE_ZIP_OPERATION_H_
20 #define MINDSPORE_CCSRC_FRONTEND_OPERATOR_COMPOSITE_ZIP_OPERATION_H_
21 
22 #include <string>
23 #include <map>
24 #include <set>
25 #include <memory>
26 
27 #include "utils/hash_map.h"
28 #include "pipeline/jit/ps/static_analysis/static_analysis.h"
29 #include "utils/misc.h"
30 #include "utils/any.h"
31 #include "ir/dtype.h"
32 #include "ir/meta_func_graph.h"
33 
34 namespace mindspore {
35 // namespace to support composite operators definition
36 namespace prim {
37 using AbstractBasePtr = abstract::AbstractBasePtr;
38 using AbstractBasePtrList = abstract::AbstractBasePtrList;
39 using AbstractTuplePtr = abstract::AbstractTuplePtr;
40 
41 class ZipOperation : public MetaFuncGraph {
42  public:
ZipOperation(const std::string & name)43   explicit ZipOperation(const std::string &name) : MetaFuncGraph(name) {}
44   ~ZipOperation() override = default;
45   MS_DECLARE_PARENT(ZipOperation, MetaFuncGraph)
46   FuncGraphPtr GenerateFuncGraph(const AbstractBasePtrList &args_abs_list) override;
47   friend std::ostream &operator<<(std::ostream &os, const ZipOperation &op) {
48     os << op.name_;
49     return os;
50   }
51   friend bool operator==(const ZipOperation &lhs, const ZipOperation &rhs) { return lhs.name_ == rhs.name_; }
52 };
53 using ZipOperationPtr = std::shared_ptr<ZipOperation>;
54 }  // namespace prim
55 }  // namespace mindspore
56 
57 #endif  // MINDSPORE_CCSRC_FRONTEND_OPERATOR_COMPOSITE_ZIP_OPERATION_H_
58