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