softplus.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/op.hpp"
21 
22 namespace ngraph
23 {
24  namespace op
25  {
26  namespace v4
27  {
28  /// \brief A Self Regularized Non-Monotonic Neural Activation Function
29  /// f(x) = ln(exp(x) + 1.)
30  ///
31  class NGRAPH_API SoftPlus : public ngraph::op::Op
32  {
33  public:
34  NGRAPH_RTTI_DECLARATION;
35 
36  SoftPlus() = default;
37  /// \brief Constructs an SoftPlus operation.
38  ///
39  /// \param data Input tensor
40  SoftPlus(const Output<Node>& arg);
41  bool visit_attributes(AttributeVisitor& visitor) override;
42  void validate_and_infer_types() override;
43 
44  virtual std::shared_ptr<Node>
45  clone_with_new_inputs(const OutputVector& new_args) const override;
46 
47  bool evaluate(const HostTensorVector& outputs,
48  const HostTensorVector& inputs) const override;
49  };
50  }
51  }
52 }
ngraph::op::v4::SoftPlus::validate_and_infer_types
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
ngraph::op::v4::SoftPlus
A Self Regularized Non-Monotonic Neural Activation Function f(x) = ln(exp(x) + 1.)
Definition: softplus.hpp:32
ngraph::op::v4::SoftPlus::SoftPlus
SoftPlus(const Output< Node > &arg)
Constructs an SoftPlus operation.
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::AttributeVisitor
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:70
ngraph::op::Op
Root of all actual ops.
Definition: op.hpp:29