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 #include "ops/op_utils.h" 19 20 namespace mindspore { 21 namespace ops { Init(const int64_t sub_graph_index)22void 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)23void PartialFusion::set_sub_graph_index(const int64_t sub_graph_index) { 24 (void)this->AddAttr(kSubGraphIndex, MakeValue(sub_graph_index)); 25 } get_sub_graph_index() const26int64_t PartialFusion::get_sub_graph_index() const { 27 auto value_ptr = GetAttr(kSubGraphIndex); 28 MS_EXCEPTION_IF_NULL(value_ptr); 29 return GetValue<int64_t>(value_ptr); 30 } 31 REGISTER_PRIMITIVE_C(kNamePartialFusion, PartialFusion); 32 } // namespace ops 33 } // namespace mindspore 34