• 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 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 <vector>
23 #include <string>
24 #include <unordered_map>
25 #include <utility>
26 #include <map>
27 #include <set>
28 #include <memory>
29 
30 #include "pipeline/jit/static_analysis/static_analysis.h"
31 #include "utils/misc.h"
32 #include "utils/any.h"
33 #include "ir/dtype.h"
34 #include "ir/meta_func_graph.h"
35 
36 namespace mindspore {
37 // namespace to support composite operators definition
38 namespace prim {
39 using AbstractBasePtr = abstract::AbstractBasePtr;
40 using AbstractBasePtrList = abstract::AbstractBasePtrList;
41 using AbstractTuplePtr = abstract::AbstractTuplePtr;
42 
43 class ZipOperation : public MetaFuncGraph {
44  public:
ZipOperation(const std::string & name)45   explicit ZipOperation(const std::string &name) : MetaFuncGraph(name) {}
46   ~ZipOperation() override = default;
47   MS_DECLARE_PARENT(ZipOperation, MetaFuncGraph)
48   FuncGraphPtr GenerateFuncGraph(const AbstractBasePtrList &args_spec_list) override;
49   friend std::ostream &operator<<(std::ostream &os, const ZipOperation &op) {
50     os << op.name_;
51     return os;
52   }
53   friend bool operator==(const ZipOperation &lhs, const ZipOperation &rhs) { return lhs.name_ == rhs.name_; }
54 };
55 using ZipOperationPtr = std::shared_ptr<ZipOperation>;
56 }  // namespace prim
57 }  // namespace mindspore
58 
59 #endif  // MINDSPORE_CCSRC_FRONTEND_OPERATOR_COMPOSITE_ZIP_OPERATION_H_
60