mish.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include "ngraph/node.hpp"
8 #include "ngraph/op/op.hpp"
9 
10 namespace ngraph
11 {
12  namespace op
13  {
14  namespace v4
15  {
16  /// \brief A Self Regularized Non-Monotonic Neural Activation Function
17  /// f(x) = x * tanh(log(exp(x) + 1.))
18  ///
19  class NGRAPH_API Mish : public ngraph::op::Op
20  {
21  public:
22  static constexpr NodeTypeInfo type_info{"Mish", 4};
23  const NodeTypeInfo& get_type_info() const override { return type_info; }
24  Mish() = default;
25  /// \brief Constructs an Mish operation.
26  ///
27  /// \param data Input tensor
28  Mish(const Output<Node>& arg);
29  bool visit_attributes(AttributeVisitor& visitor) override;
30  void validate_and_infer_types() override;
31 
32  virtual std::shared_ptr<Node>
33  clone_with_new_inputs(const OutputVector& new_args) const override;
34 
35  bool evaluate(const HostTensorVector& outputs,
36  const HostTensorVector& inputs) const override;
37  bool has_evaluate() const override;
38  };
39  } // namespace v4
40  } // namespace op
41 } // namespace ngraph
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:59
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Root of all actual ops.
Definition: op.hpp:17
A Self Regularized Non-Monotonic Neural Activation Function f(x) = x * tanh(log(exp(x) + 1....
Definition: mish.hpp:20
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
bool has_evaluate() const override
Allows to get information about availability of evaluate method for the current operation.
Mish(const Output< Node > &arg)
Constructs an Mish operation.
const NodeTypeInfo & get_type_info() const override
Definition: mish.hpp:23
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27