experimental_detectron_prior_grid_generator.hpp
1 //*****************************************************************************
2 // Copyright 2017-2021 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 <cstdint>
20 #include <vector>
21 #include "ngraph/attribute_adapter.hpp"
22 #include "ngraph/op/op.hpp"
23 #include "ngraph/op/util/attr_types.hpp"
24 
25 namespace ngraph
26 {
27  namespace op
28  {
29  namespace v6
30  {
31  /// \brief An operation ExperimentalDetectronPriorGridGenerator, according to
32  /// the repository https://github.com/openvinotoolkit/training_extensions
33  /// (see pytorch_toolkit/instance_segmentation/segmentoly/rcnn/prior_box.py).
34  class NGRAPH_API ExperimentalDetectronPriorGridGenerator : public Op
35  {
36  public:
37  NGRAPH_RTTI_DECLARATION;
38 
39  /// \brief Structure that specifies attributes of the operation
40  struct Attributes
41  {
42  // Specifies whether the output tensor should be 2D or 4D
43  // `true` means the output tensor should be 2D tensor,
44  // `false` means the output tensor should be 4D tensor.
45  bool flatten;
46  // Specifies number of cells of the generated grid with respect to height.
47  int64_t h;
48  // Specifies number of cells of the generated grid with respect to width.
49  int64_t w;
50  // Specifies the step of generated grid with respect to x coordinate
51  float stride_x;
52  // Specifies the step of generated grid with respect to y coordinate
53  float stride_y;
54  };
55 
57  /// \brief Constructs a ExperimentalDetectronDetectionOutput operation.
58  ///
59  /// \param priors Input priors
60  /// \param feature_map Input feature map
61  /// \param im_data Image data
62  /// \param attrs attributes
64  const Output<Node>& feature_map,
65  const Output<Node>& im_data,
66  const Attributes& attrs);
67  bool visit_attributes(AttributeVisitor& visitor) override;
68 
69  void validate_and_infer_types() override;
70 
71  std::shared_ptr<Node>
72  clone_with_new_inputs(const OutputVector& new_args) const override;
73  /// \brief Returns attributes of this operation.
74  const Attributes& get_attrs() const { return m_attrs; }
75  private:
76  Attributes m_attrs;
77 
78  void validate();
79  };
80  }
81  }
82 }
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:71
A handle for one of a node's outputs.
Definition: node_output.hpp:42
Root of all actual ops.
Definition: op.hpp:29
An operation ExperimentalDetectronPriorGridGenerator, according to the repository https://github....
Definition: experimental_detectron_prior_grid_generator.hpp:35
ExperimentalDetectronPriorGridGenerator(const Output< Node > &priors, const Output< Node > &feature_map, const Output< Node > &im_data, const Attributes &attrs)
Constructs a ExperimentalDetectronDetectionOutput operation.
const Attributes & get_attrs() const
Returns attributes of this operation.
Definition: experimental_detectron_prior_grid_generator.hpp:74
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:28
Structure that specifies attributes of the operation.
Definition: experimental_detectron_prior_grid_generator.hpp:41