experimental_detectron_prior_grid_generator.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <cstdint>
8 #include <vector>
9 #include "ngraph/attribute_adapter.hpp"
10 #include "ngraph/op/op.hpp"
11 #include "ngraph/op/util/attr_types.hpp"
12 
13 namespace ngraph
14 {
15  namespace op
16  {
17  namespace v6
18  {
19  /// \brief An operation ExperimentalDetectronPriorGridGenerator generates prior
20  /// grids of specified sizes.
21  class NGRAPH_API ExperimentalDetectronPriorGridGenerator : public Op
22  {
23  public:
24  NGRAPH_RTTI_DECLARATION;
25 
26  /// \brief Structure that specifies attributes of the operation
27  struct Attributes
28  {
29  // Specifies whether the output tensor should be 2D or 4D
30  // `true` means the output tensor should be 2D tensor,
31  // `false` means the output tensor should be 4D tensor.
32  bool flatten;
33  // Specifies number of cells of the generated grid with respect to height.
34  int64_t h;
35  // Specifies number of cells of the generated grid with respect to width.
36  int64_t w;
37  // Specifies the step of generated grid with respect to x coordinate
38  float stride_x;
39  // Specifies the step of generated grid with respect to y coordinate
40  float stride_y;
41  };
42 
44  /// \brief Constructs a ExperimentalDetectronDetectionOutput operation.
45  ///
46  /// \param priors Input priors
47  /// \param feature_map Input feature map
48  /// \param im_data Image data
49  /// \param attrs attributes
51  const Output<Node>& feature_map,
52  const Output<Node>& im_data,
53  const Attributes& attrs);
54  bool visit_attributes(AttributeVisitor& visitor) override;
55 
56  void validate_and_infer_types() override;
57 
58  std::shared_ptr<Node>
59  clone_with_new_inputs(const OutputVector& new_args) const override;
60  /// \brief Returns attributes of this operation.
61  const Attributes& get_attrs() const { return m_attrs; }
62 
63  private:
64  Attributes m_attrs;
65 
66  void validate();
67  };
68  } // namespace v6
69  } // namespace op
70 } // 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
An operation ExperimentalDetectronPriorGridGenerator generates prior grids of specified sizes.
Definition: experimental_detectron_prior_grid_generator.hpp:22
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:61
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
Structure that specifies attributes of the operation.
Definition: experimental_detectron_prior_grid_generator.hpp:28