roi_pooling.hpp
1 //*****************************************************************************
2 // Copyright 2017-2020 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 "ngraph/op/op.hpp"
20 
21 namespace ngraph
22 {
23  namespace op
24  {
25  namespace v0
26  {
27  class NGRAPH_API ROIPooling : public Op
28  {
29  public:
30  static constexpr NodeTypeInfo type_info{"ROIPooling", 0};
31  const NodeTypeInfo& get_type_info() const override { return type_info; }
32  ROIPooling() = default;
33  /// \brief Constructs a ROIPooling operation
34  ///
35  /// \param input Input feature map {N, C, ...}
36  /// \param coords Coordinates of bounding boxes
37  /// \param output_size Height/Width of ROI output features
38  /// \param spatial_scale Ratio of input feature map over input image size
39  /// \param method Method of pooling - Max or Bilinear
40  ROIPooling(const Output<Node>& input,
41  const Output<Node>& coords,
42  const Shape& output_size,
43  const float spatial_scale,
44  const std::string& method);
45 
46  void validate_and_infer_types() override;
47 
48  virtual std::shared_ptr<Node>
49  clone_with_new_inputs(const OutputVector& new_args) const override;
50 
51  const Shape& get_output_size() const { return m_output_size; }
52  float get_spatial_scale() const { return m_spatial_scale; }
53  const std::string& get_method() const { return m_method; }
54  bool visit_attributes(AttributeVisitor& visitor) override;
55 
56  private:
57  Shape m_output_size;
58  float m_spatial_scale;
59  std::string m_method;
60  };
61  }
62  using v0::ROIPooling;
63  }
64 }
ngraph::op::v0::ROIPooling::ROIPooling
ROIPooling(const Output< Node > &input, const Output< Node > &coords, const Shape &output_size, const float spatial_scale, const std::string &method)
Constructs a ROIPooling operation.
ngraph::op::v0::ROIPooling::validate_and_infer_types
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
ngraph::op::v0::ROIPooling::get_type_info
const NodeTypeInfo & get_type_info() const override
Definition: roi_pooling.hpp:31
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::AttributeVisitor
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:70
ngraph::op::v0::ROIPooling
Definition: roi_pooling.hpp:28
ngraph::op::Op
Root of all actual ops.
Definition: op.hpp:29