psroi_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 PSROIPooling : public Op
16  {
17  public:
18  static constexpr NodeTypeInfo type_info{"PSROIPooling", 0};
19  const NodeTypeInfo& get_type_info() const override { return type_info; }
20  PSROIPooling() = default;
21  /// \brief Constructs a PSROIPooling operation
22  ///
23  /// \param input Input feature map {N, C, ...}
24  /// \param coords Coordinates of bounding boxes
25  /// \param output_dim Output channel number
26  /// \param group_size Number of groups to encode position-sensitive scores
27  /// \param spatial_scale Ratio of input feature map over input image size
28  /// \param spatial_bins_x Numbers of bins to divide the input feature maps over
29  /// width
30  /// \param spatial_bins_y Numbers of bins to divide the input feature maps over
31  /// height
32  /// \param mode Mode of pooling - Avg or Bilinear
33  PSROIPooling(const Output<Node>& input,
34  const Output<Node>& coords,
35  const size_t output_dim,
36  const size_t group_size,
37  const float spatial_scale,
38  int spatial_bins_x,
39  int spatial_bins_y,
40  const std::string& mode);
41 
42  bool visit_attributes(AttributeVisitor& visitor) override;
43  void validate_and_infer_types() override;
44 
45  virtual std::shared_ptr<Node>
46  clone_with_new_inputs(const OutputVector& new_args) const override;
47 
48  size_t get_output_dim() const { return m_output_dim; }
49  size_t get_group_size() const { return m_group_size; }
50  float get_spatial_scale() const { return m_spatial_scale; }
51  int get_spatial_bins_x() const { return m_spatial_bins_x; }
52  int get_spatial_bins_y() const { return m_spatial_bins_y; }
53  const std::string& get_mode() const { return m_mode; }
54 
55  private:
56  size_t m_output_dim;
57  size_t m_group_size;
58  float m_spatial_scale;
59  int m_spatial_bins_x;
60  int m_spatial_bins_y;
61  std::string m_mode;
62  };
63  } // namespace v0
64  using v0::PSROIPooling;
65  } // namespace op
66 } // 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
Definition: psroi_pooling.hpp:16
const NodeTypeInfo & get_type_info() const override
Definition: psroi_pooling.hpp:19
PSROIPooling(const Output< Node > &input, const Output< Node > &coords, const size_t output_dim, const size_t group_size, const float spatial_scale, int spatial_bins_x, int spatial_bins_y, const std::string &mode)
Constructs a PSROIPooling 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