deformable_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 v1
26  {
27  class NGRAPH_API DeformablePSROIPooling : public Op
28  {
29  public:
30  static constexpr NodeTypeInfo type_info{"DeformablePSROIPooling", 1};
31  const NodeTypeInfo& get_type_info() const override { return type_info; }
32  DeformablePSROIPooling() = default;
33  /// \brief Constructs a DeformablePSROIPooling operation
34  ///
35  /// \param input Input tensor with feature maps
36  /// \param coords Input tensor describing box consisting
37  /// of five element tuples
38  /// \param offsets Input blob with transformation values
39  /// \param output_dim Pooled output channel number
40  /// \param group_size Number of groups to encode position-sensitive score maps
41  /// \param spatial_scale Multiplicative spatial scale factor to translate ROI
42  /// coordinates from their input scale to the scale used when
43  /// pooling
44  /// \param mode Specifies mode for pooling.
45  /// \param spatial_bins_x Specifies numbers of bins to divide the input feature
46  /// maps over width
47  /// \param spatial_bins_y Specifies numbers of bins to divide the input feature
48  /// maps over height
49  /// \param no_trans The flag that specifies whenever third input exists
50  /// and contains transformation (offset) values
51  /// \param trans_std The value that all transformation (offset) values are
52  /// multiplied with
53  /// \param part_size The number of parts the output tensor spatial dimensions
54  /// are divided into. Basically it is the height
55  /// and width of the third input
56  DeformablePSROIPooling(const Output<Node>& input,
57  const Output<Node>& coords,
58  const Output<Node>& offsets,
59  const int64_t output_dim,
60  const float spatial_scale,
61  const int64_t group_size = 1,
62  const std::string mode = "bilinear_deformable",
63  int64_t spatial_bins_x = 1,
64  int64_t spatial_bins_y = 1,
65  float trans_std = 1,
66  int64_t part_size = 1);
67 
68  DeformablePSROIPooling(const Output<Node>& input,
69  const Output<Node>& coords,
70  const int64_t output_dim,
71  const float spatial_scale,
72  const int64_t group_size = 1,
73  const std::string mode = "bilinear_deformable",
74  int64_t spatial_bins_x = 1,
75  int64_t spatial_bins_y = 1,
76  float trans_std = 1,
77  int64_t part_size = 1);
78 
79  bool visit_attributes(AttributeVisitor& visitor) override;
80 
81  void validate_and_infer_types() override;
82 
83  virtual std::shared_ptr<Node>
84  clone_with_new_inputs(const OutputVector& new_args) const override;
85 
86  int64_t get_output_dim() const { return m_output_dim; }
87  int64_t get_group_size() const { return m_group_size; }
88  float get_spatial_scale() const { return m_spatial_scale; }
89  const std::string& get_mode() const { return m_mode; }
90  int64_t get_spatial_bins_x() const { return m_spatial_bins_x; }
91  int64_t get_spatial_bins_y() const { return m_spatial_bins_y; }
92  float get_trans_std() const { return m_trans_std; }
93  int64_t get_part_size() const { return m_part_size; }
94  private:
95  int64_t m_output_dim;
96  float m_spatial_scale;
97  int64_t m_group_size;
98  std::string m_mode;
99  int64_t m_spatial_bins_x;
100  int64_t m_spatial_bins_y;
101  float m_trans_std;
102  int64_t m_part_size;
103  };
104  }
105  }
106 }
ngraph::op::v1::DeformablePSROIPooling::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::v1::DeformablePSROIPooling
Definition: deformable_psroi_pooling.hpp:28
ngraph::op::v1::DeformablePSROIPooling::get_type_info
const NodeTypeInfo & get_type_info() const override
Definition: deformable_psroi_pooling.hpp:31
ngraph::op::v1::DeformablePSROIPooling::DeformablePSROIPooling
DeformablePSROIPooling(const Output< Node > &input, const Output< Node > &coords, const Output< Node > &offsets, const int64_t output_dim, const float spatial_scale, const int64_t group_size=1, const std::string mode="bilinear_deformable", int64_t spatial_bins_x=1, int64_t spatial_bins_y=1, float trans_std=1, int64_t part_size=1)
Constructs a DeformablePSROIPooling operation.
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::Op
Root of all actual ops.
Definition: op.hpp:29