prelu.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 v0
15  {
16  /// \brief Parametrized Relu
17  /// x < 0 => f(x) = x * slope
18  /// x >= 0 => f(x) = x
19  ///
20  class NGRAPH_API PRelu : public ngraph::op::Op
21  {
22  public:
23  NGRAPH_RTTI_DECLARATION;
24  PRelu();
25  /// \brief Constructs a PRelu operation.
26  ///
27  /// \param data Input tensor
28  /// \param slope Multipliers for negative values
29  PRelu(const Output<Node>& data, const Output<Node>& slope);
30 
31  bool visit_attributes(AttributeVisitor& visitor) override;
32 
33  virtual std::shared_ptr<Node>
34  clone_with_new_inputs(const OutputVector& new_args) const override;
35 
36  void validate_and_infer_types() override;
37 
38  bool evaluate(const HostTensorVector& outputs,
39  const HostTensorVector& inputs) const override;
40  bool has_evaluate() const override;
41  };
42  } // namespace v0
43  using v0::PRelu;
44  } // namespace op
45 } // 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
Parametrized Relu x < 0 => f(x) = x * slope x >= 0 => f(x) = x.
Definition: prelu.hpp:21
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.
PRelu(const Output< Node > &data, const Output< Node > &slope)
Constructs a PRelu operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16