sqrt.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  // clang-format off
16  /// \brief Elementwise square root operation.
17  ///
18  /// ## Inputs
19  ///
20  /// | | Type | Description |
21  /// | ----- | --------------------------------- | ----------------------------------------------- |
22  /// | `arg` | \f$N[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of any shape and numeric element type. |
23  ///
24  /// ## Output
25  ///
26  /// | Type | Description |
27  /// | ---------------------- | ------------------------------------------------------------------------------------- |
28  /// | \f$N[d_1,\dots,d_n]\f$ | The tensor \f$T\f$, where \f$T[i_1,\dots,i_n] = \sqrt{\texttt{arg}[i_1,\dots,i_n]}\f$ |
29  // clang-format on
30  class NGRAPH_API Sqrt : public util::UnaryElementwiseArithmetic
31  {
32  public:
33  NGRAPH_RTTI_DECLARATION;
34 
35  /// \brief Constructs a square operation.
36  ///
37  /// \param arg Node that produces the input tensor.
38  Sqrt(const Output<Node>& arg);
39  Sqrt() = default;
40 
41  bool visit_attributes(AttributeVisitor& visitor) override;
42  virtual std::shared_ptr<Node>
43  clone_with_new_inputs(const OutputVector& new_args) const override;
44  bool evaluate(const HostTensorVector& outputs,
45  const HostTensorVector& inputs) const override;
46  bool has_evaluate() const override;
47  };
48  } // namespace v0
49  using v0::Sqrt;
50  } // namespace op
51 } // 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 square root operation.
Definition: sqrt.hpp:31
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
Sqrt(const Output< Node > &arg)
Constructs a square operation.
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