extractimagepatches.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 v3
14  {
15  class NGRAPH_API ExtractImagePatches : public Op
16  {
17  public:
18  static constexpr NodeTypeInfo type_info{"ExtractImagePatches", 3};
19  const NodeTypeInfo& get_type_info() const override { return type_info; }
20  ExtractImagePatches() = default;
21  /// \brief Constructs a ExtractImagePatches operation
22  ///
23  /// \param data 4-D Input data to extract image patches
24  /// \param sizes Patch size in the format of [size_rows, size_cols]
25  /// \param strides Patch movement stride in the format of [stride_rows, stride_cols]
26  /// \param rates Element seleciton rate for creating a patch. in the format of
27  /// [rate_rows, rate_cols]
28  /// \param auto_pad Padding type. it can be any value from
29  /// valid, same_lower, same_upper
31  const Shape& sizes,
32  const Strides& strides,
33  const Shape& rates,
34  const PadType& auto_pad);
35 
36  void validate_and_infer_types() override;
37  bool visit_attributes(AttributeVisitor& visitor) override;
38 
39  virtual std::shared_ptr<Node>
40  clone_with_new_inputs(const OutputVector& new_args) const override;
41 
42  const Shape& get_sizes() const { return m_patch_sizes; }
43  void set_sizes(const Shape& sizes) { m_patch_sizes = sizes; }
44  const Strides& get_strides() const { return m_patch_movement_strides; }
45  void set_strides(const Strides& strides) { m_patch_movement_strides = strides; }
46  const Shape& get_rates() const { return m_patch_selection_rates; }
47  void set_rates(const Shape& rates) { m_patch_selection_rates = rates; }
48  const PadType& get_auto_pad() const { return m_padding; }
49  void set_auto_pad(PadType& padding) { m_padding = padding; }
50 
51  private:
52  Shape m_patch_sizes;
53  Strides m_patch_movement_strides;
54  Shape m_patch_selection_rates;
55  PadType m_padding;
56  };
57  } // namespace v3
58  using v3::ExtractImagePatches;
59  } // namespace op
60 } // 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
Shape for a tensor.
Definition: shape.hpp:19
Strides for a tensor.
Definition: strides.hpp:18
Root of all actual ops.
Definition: op.hpp:17
Definition: extractimagepatches.hpp:16
const NodeTypeInfo & get_type_info() const override
Definition: extractimagepatches.hpp:19
ExtractImagePatches(const Output< Node > &image, const Shape &sizes, const Strides &strides, const Shape &rates, const PadType &auto_pad)
Constructs a ExtractImagePatches operation.
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
PadType
Padding Type used for Convolution and Pooling
Definition: attr_types.hpp:61
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27