grn.hpp
1 //*****************************************************************************
2 // Copyright 2017-2021 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 <memory>
20 
21 #include "ngraph/node.hpp"
22 #include "ngraph/op/util/fused_op.hpp"
23 
24 NGRAPH_SUPPRESS_DEPRECATED_START
25 
26 namespace ngraph
27 {
28  namespace op
29  {
30  namespace v0
31  {
32  /// \brief Global Response Normalization with L2 norm (across channels only).
33  ///
34  class NGRAPH_API GRN : public ngraph::op::util::FusedOp
35  {
36  public:
37  static constexpr NodeTypeInfo type_info{"GRN", 0};
38  const NodeTypeInfo& get_type_info() const override { return type_info; }
39  GRN();
40  /// \brief Constructs a GRN operation.
41  ///
42  /// \param data - Node producing the input tensor
43  /// \param bias - The bias added to the variance.
44  ///
45  GRN(const Output<Node>& data, float bias);
46 
47  bool visit_attributes(AttributeVisitor& visitor) override;
48  float get_bias() const { return m_bias; }
49  virtual void pre_validate_and_infer_types() override;
50  virtual OutputVector decompose_op() const override;
51 
52  virtual std::shared_ptr<Node>
53  clone_with_new_inputs(const OutputVector& new_args) const override;
54 
55  protected:
56  float m_bias = 1.0f;
57  };
58  }
59  using v0::GRN;
60  }
61 }
62 
63 NGRAPH_SUPPRESS_DEPRECATED_END
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:71
A handle for one of a node's outputs.
Definition: node_output.hpp:42
Global Response Normalization with L2 norm (across channels only).
Definition: grn.hpp:35
GRN(const Output< Node > &data, float bias)
Constructs a GRN operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
Definition: type.hpp:39