hard_sigmoid.hpp
1 //*****************************************************************************
2 // Copyright 2017-2020 Intel Corporation
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 #pragma once
18 
19 #include "ngraph/node.hpp"
20 #include "ngraph/op/util/fused_op.hpp"
21 
22 NGRAPH_SUPPRESS_DEPRECATED_START
23 
24 namespace ngraph
25 {
26  namespace op
27  {
28  namespace v0
29  {
30  /// \brief Parameterized, bounded sigmoid-like, piecewise linear
31  /// function. min(max(alpha*x + beta, 0), 1)
32  ///
33  class NGRAPH_API HardSigmoid : public ngraph::op::util::FusedOp
34  {
35  public:
36  static constexpr NodeTypeInfo type_info{"HardSigmoid", 0};
37  const NodeTypeInfo& get_type_info() const override { return type_info; }
38  HardSigmoid() = default;
39 
40  /// \brief Constructs a HardSigmoid operation.
41  ///
42  /// \param data Input tensor.
43  /// \param[in] alpha A scalar value representing the alpha parameter.
44  /// \param[in] beta A scalar value representing the beta parameter.
45  ///
46  HardSigmoid(const Output<Node>& data,
47  const Output<Node>& alpha,
48  const Output<Node>& beta);
49 
50  bool visit_attributes(AttributeVisitor& visitor) override;
51  virtual void pre_validate_and_infer_types() override;
52  virtual OutputVector decompose_op() const override;
53  virtual std::shared_ptr<Node>
54  clone_with_new_inputs(const OutputVector& new_args) const override;
55  };
56  }
57  using v0::HardSigmoid;
58  }
59 }
60 
61 NGRAPH_SUPPRESS_DEPRECATED_END
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::op::v0::HardSigmoid
Parameterized, bounded sigmoid-like, piecewise linear function. min(max(alpha*x + beta,...
Definition: hard_sigmoid.hpp:34
ngraph::op::v0::HardSigmoid::HardSigmoid
HardSigmoid(const Output< Node > &data, const Output< Node > &alpha, const Output< Node > &beta)
Constructs a HardSigmoid operation.
ngraph::AttributeVisitor
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:70