roi_pooling.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/op.hpp"
8 
9 namespace ngraph
10 {
11  namespace op
12  {
13  namespace v0
14  {
15  class NGRAPH_API ROIPooling : public Op
16  {
17  public:
18  static constexpr NodeTypeInfo type_info{"ROIPooling", 0};
19  const NodeTypeInfo& get_type_info() const override { return type_info; }
20  ROIPooling() = default;
21  /// \brief Constructs a ROIPooling operation
22  ///
23  /// \param input Input feature map {N, C, H, W}
24  /// \param coords Coordinates of bounding boxes
25  /// \param output_size Height/Width of ROI output features
26  /// \param spatial_scale Ratio of input feature map over input image size
27  /// \param method Method of pooling - Max or Bilinear
28  ROIPooling(const Output<Node>& input,
29  const Output<Node>& coords,
30  const Shape& output_size,
31  const float spatial_scale,
32  const std::string& method = "max");
33 
34  void validate_and_infer_types() override;
35 
36  virtual std::shared_ptr<Node>
37  clone_with_new_inputs(const OutputVector& new_args) const override;
38 
39  const Shape& get_output_size() const { return m_output_size; }
40  float get_spatial_scale() const { return m_spatial_scale; }
41  const std::string& get_method() const { return m_method; }
42  bool visit_attributes(AttributeVisitor& visitor) override;
43 
44  private:
45  Shape m_output_size{0, 0};
46  float m_spatial_scale;
47  std::string m_method = "max";
48  };
49 
50  } // namespace v0
51  using v0::ROIPooling;
52 
53  } // namespace op
54 
55 } // 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
Shape for a tensor.
Definition: shape.hpp:19
Root of all actual ops.
Definition: op.hpp:17
Definition: roi_pooling.hpp:16
const NodeTypeInfo & get_type_info() const override
Definition: roi_pooling.hpp:19
ROIPooling(const Output< Node > &input, const Output< Node > &coords, const Shape &output_size, const float spatial_scale, const std::string &method="max")
Constructs a ROIPooling operation.
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27