deformable_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 v1
14  {
15  class NGRAPH_API DeformablePSROIPooling : public Op
16  {
17  public:
18  static constexpr NodeTypeInfo type_info{"DeformablePSROIPooling", 1};
19  const NodeTypeInfo& get_type_info() const override { return type_info; }
20  DeformablePSROIPooling() = default;
21  /// \brief Constructs a DeformablePSROIPooling operation
22  ///
23  /// \param input Input tensor with position sensitive score maps
24  /// \param coords Input tensor with list of five element tuples
25  /// describing ROI coordinates
26  /// \param offsets Input tensor with transformation values
27  /// \param output_dim Pooled output channel number
28  /// \param group_size Number of horizontal bins per row to divide ROI area,
29  /// it defines output width and height
30  /// \param spatial_scale Multiplicative spatial scale factor to translate ROI
31  /// coordinates from their input scale to the scale used when
32  /// pooling
33  /// \param mode Specifies mode for pooling.
34  /// \param spatial_bins_x Specifies numbers of bins to divide ROI single
35  /// bin over width
36  /// \param spatial_bins_y Specifies numbers of bins to divide ROI single
37  /// bin over height
38  /// \param no_trans The flag that specifies whenever third input exists
39  /// and contains transformation (offset) values
40  /// \param trans_std The value that all transformation (offset) values are
41  /// multiplied with
42  /// \param part_size The number of parts the output tensor spatial dimensions
43  /// are divided into. Basically it is the height
44  /// and width of the third input
46  const Output<Node>& coords,
47  const Output<Node>& offsets,
48  const int64_t output_dim,
49  const float spatial_scale,
50  const int64_t group_size = 1,
51  const std::string mode = "bilinear_deformable",
52  int64_t spatial_bins_x = 1,
53  int64_t spatial_bins_y = 1,
54  float trans_std = 1,
55  int64_t part_size = 1);
56 
58  const Output<Node>& coords,
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  bool visit_attributes(AttributeVisitor& visitor) override;
69 
70  void validate_and_infer_types() override;
71 
72  virtual std::shared_ptr<Node>
73  clone_with_new_inputs(const OutputVector& new_args) const override;
74 
75  int64_t get_output_dim() const { return m_output_dim; }
76  int64_t get_group_size() const { return m_group_size; }
77  float get_spatial_scale() const { return m_spatial_scale; }
78  const std::string& get_mode() const { return m_mode; }
79  int64_t get_spatial_bins_x() const { return m_spatial_bins_x; }
80  int64_t get_spatial_bins_y() const { return m_spatial_bins_y; }
81  float get_trans_std() const { return m_trans_std; }
82  int64_t get_part_size() const { return m_part_size; }
83 
84  private:
85  int64_t m_output_dim;
86  float m_spatial_scale;
87  int64_t m_group_size = 1;
88  std::string m_mode = "bilinear_deformable";
89  int64_t m_spatial_bins_x = 1;
90  int64_t m_spatial_bins_y = 1;
91  float m_trans_std = 1.f;
92  int64_t m_part_size = 1;
93  };
94  } // namespace v1
95  } // namespace op
96 } // 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: deformable_psroi_pooling.hpp:16
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.
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
const NodeTypeInfo & get_type_info() const override
Definition: deformable_psroi_pooling.hpp:19
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27