tanh.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include "ngraph/op/util/unary_elementwise_arithmetic.hpp"
8 
9 namespace ngraph
10 {
11  namespace op
12  {
13  namespace v0
14  {
15  /// \brief Elementwise hyperbolic tangent operation.
16  class NGRAPH_API Tanh : public util::UnaryElementwiseArithmetic
17  {
18  public:
19  static constexpr NodeTypeInfo type_info{"Tanh", 0};
20  const NodeTypeInfo& get_type_info() const override { return type_info; }
21  /// \brief Constructs a hyperbolic tangent operation.
22  ///
23  /// \param arg Node that produces the input tensor.
24  Tanh(const Output<Node>& arg);
25  Tanh() = default;
26 
27  bool visit_attributes(AttributeVisitor& visitor) override;
28  virtual std::shared_ptr<Node>
29  clone_with_new_inputs(const OutputVector& new_args) const override;
30  bool evaluate(const HostTensorVector& outputs,
31  const HostTensorVector& inputs) const override;
32  bool has_evaluate() const override;
33  };
34  } // namespace v0
35  using v0::Tanh;
36  } // namespace op
37 } // 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
Abstract base class for elementwise unary arithmetic operations, i.e., operations where the same scal...
Definition: unary_elementwise_arithmetic.hpp:37
Elementwise hyperbolic tangent operation.
Definition: tanh.hpp:17
Tanh(const Output< Node > &arg)
Constructs a hyperbolic tangent operation.
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
const NodeTypeInfo & get_type_info() const override
Definition: tanh.hpp:20
bool has_evaluate() const override
Allows to get information about availability of evaluate method for the current operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27