• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 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 #ifndef MINDSPORE_CORE_OPS_CUSTOM_PREDICT_H_
17 #define MINDSPORE_CORE_OPS_CUSTOM_PREDICT_H_
18 #include <memory>
19 #include <vector>
20 
21 #include "ops/primitive_c.h"
22 #include "ops/op_utils.h"
23 #include "abstract/abstract_value.h"
24 #include "utils/check_convert_utils.h"
25 
26 namespace mindspore {
27 namespace ops {
28 constexpr auto kNameCustomPredict = "CustomPredict";
29 class MS_CORE_API CustomPredict : public PrimitiveC {
30  public:
CustomPredict()31   CustomPredict() : PrimitiveC(kNameCustomPredict) {}
32   ~CustomPredict() = default;
33   MS_DECLARE_PARENT(CustomPredict, PrimitiveC);
34   void Init(const int64_t output_num, const float weight_threshold);
35   void set_output_num(const int64_t output_num);
36   void set_weight_threshold(const float weight_threshold);
37   int64_t get_output_num() const;
38   float get_weight_threshold() const;
39 };
40 AbstractBasePtr CustomPredictInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive,
41                                    const std::vector<AbstractBasePtr> &input_args);
42 using PrimCustomPredictPtr = std::shared_ptr<CustomPredict>;
43 }  // namespace ops
44 }  // namespace mindspore
45 
46 #endif  // MINDSPORE_CORE_OPS_CUSTOM_PREDICT_H_
47