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 #ifndef MINDSPORE_CORE_OPS_TOPK_FUSION_H_ 18 #define MINDSPORE_CORE_OPS_TOPK_FUSION_H_ 19 20 #include "mindapi/base/types.h" 21 #include "ops/topk.h" 22 23 namespace mindspore { 24 namespace ops { 25 constexpr auto kNameTopKFusion = "TopKFusion"; 26 /// \brief TopKFusion defined TopK operator prototype of lite. 27 class MIND_API TopKFusion : public TopK { 28 public: 29 MIND_API_BASE_MEMBER(TopKFusion); 30 /// \brief Constructor. TopKFusion()31 TopKFusion() : TopK(kNameTopKFusion) {} 32 33 /// \brief Method to init the op's attributes. 34 /// 35 /// \param[in] sorted Define a boolean value indicate whether the output must be sorted. 36 /// \param[in] axis Define the operation axis, which is no use now, but the default is the last dimension. 37 /// \param[in] largest Define the number of largest value along with the axis, which is not attribute now, but the 38 /// second input of this operation. 39 void Init(const bool sorted, const int64_t axis, const int64_t largest); 40 41 /// \brief Method to set axis attribute. Do not use. 42 /// 43 /// \param[in] axis Define the operation axis, which is no use now, but the default is the last dimension. 44 void set_axis(const int64_t axis); 45 46 /// \brief Method to set largest attribute, which is no use and needs to be converted to the second input. 47 /// 48 /// \param[in] largest Define the number of largest value along with the axis, which is not attribute now, but the 49 /// second input of this operation. 50 void set_largest(const int64_t largest); 51 52 /// \brief Method to get axis attribute. 53 /// 54 /// \return axis value. 55 int64_t get_axis() const; 56 57 /// \brief Method to get largest attribute. 58 /// 59 /// \return the number of largest value 60 int64_t get_largest() const; 61 }; 62 } // namespace ops 63 } // namespace mindspore 64 65 #endif // MINDSPORE_CORE_OPS_TOPK_FUSION_H_ 66