• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FULL_CONNECTION_FUSION_H_
18 #define MINDSPORE_CORE_OPS_FULL_CONNECTION_FUSION_H_
19 #include <map>
20 #include <memory>
21 #include <string>
22 #include <vector>
23 #include "mindapi/base/types.h"
24 #include "ops/base_operator.h"
25 
26 namespace mindspore {
27 namespace ops {
28 constexpr auto kNameFullConnection = "FullConnection";
29 /// \brief FullConnection defined FullConnection operator prototype of lite.
30 class MIND_API FullConnection : public BaseOperator {
31  public:
32   MIND_API_BASE_MEMBER(FullConnection);
33   /// \brief Constructor.
FullConnection()34   FullConnection() : BaseOperator(kNameFullConnection) { InitIOName({"x1", "x2", "b"}, {"output"}); }
35 
36   /// \brief Method to init the op's attributes.
37   ///
38   /// \param[in] has_bias Define a boolean value to indicate the op has bias or not.
39   /// \param[in] axis Define a axis that the inner product is done along with
40   /// \param[in] use_axis Define a boolean value to indicate the op uses a axis or not.
41   /// \param[in] activation_type Define the activation type.
42   void Init(const bool has_bias, const int64_t axis, const bool use_axis, const ActivationType &activation_type);
43 
44   /// \brief Method to set has_axis attribute.
45   ///
46   /// \param[in] has_bias Define a boolean value to indicate the op has bias or not.
47   void set_has_bias(const bool has_bias);
48 
49   /// \brief Method to set axis attribute.
50   ///
51   /// \param[in] axis Define a axis the inner product must be along with
52   void set_axis(const int64_t axis);
53 
54   /// \brief Method to set use_axis attribute.
55   ///
56   /// \param[in] use_axis Define a boolean value to indicate the op uses a axis or not.
57   void set_use_axis(const bool use_axis);
58 
59   /// \brief Method to set activation type.
60   ///
61   /// \param[in] activation_type Define the activation type.
62   void set_activation_type(const ActivationType &activation_type);
63 
64   /// \brief Method to get has_bias attribute.
65   ///
66   /// \return a boolean value
67   bool get_has_bias() const;
68 
69   /// \brief Method to get axis attribute.
70   ///
71   /// \return axis
72   int64_t get_axis() const;
73 
74   /// \brief Method to get use_axis attribute.
75   ///
76   /// \return a boolean value.
77   bool get_use_axis() const;
78 
79   /// \brief Method to get activation type.
80   ///
81   /// \return activation type.
82   ActivationType get_activation_type() const;
83 };
84 abstract::AbstractBasePtr FullConnectionInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive,
85                                               const std::vector<abstract::AbstractBasePtr> &input_args);
86 }  // namespace ops
87 }  // namespace mindspore
88 
89 #endif  // MINDSPORE_CORE_OPS_FULL_CONNECTION_FUSION_H_
90