1 /** 2 * Copyright 2020-2021 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 #include "ops/fusion/partial_fusion.h" 18 19 #include "mindapi/base/shared_ptr.h" 20 #include "mindapi/ir/value.h" 21 #include "mindapi/src/helper.h" 22 #include "ops/op_name.h" 23 #include "ops/primitive_c.h" 24 #include "utils/log_adapter.h" 25 26 namespace mindspore { 27 namespace ops { 28 MIND_API_OPERATOR_IMPL(PartialFusion, BaseOperator); Init(const int64_t sub_graph_index)29void PartialFusion::Init(const int64_t sub_graph_index) { this->set_sub_graph_index(sub_graph_index); } set_sub_graph_index(const int64_t sub_graph_index)30void PartialFusion::set_sub_graph_index(const int64_t sub_graph_index) { 31 (void)this->AddAttr(kSubGraphIndex, api::MakeValue(sub_graph_index)); 32 } get_sub_graph_index() const33int64_t PartialFusion::get_sub_graph_index() const { 34 auto value_ptr = GetAttr(kSubGraphIndex); 35 MS_EXCEPTION_IF_NULL(value_ptr); 36 return GetValue<int64_t>(value_ptr); 37 } 38 REGISTER_PRIMITIVE_C(kNamePartialFusion, PartialFusion); 39 } // namespace ops 40 } // namespace mindspore 41