extractimagepatches.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 v3
26  {
27  class NGRAPH_API ExtractImagePatches : public Op
28  {
29  public:
30  static constexpr NodeTypeInfo type_info{"ExtractImagePatches", 3};
31  const NodeTypeInfo& get_type_info() const override { return type_info; }
32  ExtractImagePatches() = default;
33  /// \brief Constructs a ExtractImagePatches operation
34  ///
35  /// \param data 4-D Input data to extract image patches
36  /// \param sizes Patch size in the format of [size_rows, size_cols]
37  /// \param strides Patch movement stride in the format of [stride_rows, stride_cols]
38  /// \param rates Element seleciton rate for creating a patch. in the format of
39  /// [rate_rows, rate_cols]
40  /// \param auto_pad Padding type. it can be any value from
41  /// valid, same_lower, same_upper
42  ExtractImagePatches(const Output<Node>& image,
43  const Shape& sizes,
44  const Strides& strides,
45  const Shape& rates,
46  const PadType& auto_pad);
47 
48  void validate_and_infer_types() override;
49  bool visit_attributes(AttributeVisitor& visitor) override;
50 
51  virtual std::shared_ptr<Node>
52  clone_with_new_inputs(const OutputVector& new_args) const override;
53 
54  const Shape& get_sizes() const { return m_patch_sizes; }
55  void set_sizes(const Shape& sizes) { m_patch_sizes = sizes; }
56  const Strides& get_strides() const { return m_patch_movement_strides; }
57  void set_strides(const Strides& strides) { m_patch_movement_strides = strides; }
58  const Shape& get_rates() const { return m_patch_selection_rates; }
59  void set_rates(const Shape& rates) { m_patch_selection_rates = rates; }
60  const PadType& get_auto_pad() const { return m_padding; }
61  void set_auto_pad(PadType& padding) { m_padding = padding; }
62  private:
63  Shape m_patch_sizes;
64  Strides m_patch_movement_strides;
65  Shape m_patch_selection_rates;
66  PadType m_padding;
67  };
68  } // namespace v3
69  using v3::ExtractImagePatches;
70  } // namespace op
71 } // namespace ngraph
ngraph::op::PadType
PadType
Padding Type used for Convolution and Pooling
Definition: attr_types.hpp:71
ngraph::op::v3::ExtractImagePatches
Definition: extractimagepatches.hpp:28
ngraph::op::v3::ExtractImagePatches::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::v3::ExtractImagePatches::get_type_info
const NodeTypeInfo & get_type_info() const override
Definition: extractimagepatches.hpp:31
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::v3::ExtractImagePatches::ExtractImagePatches
ExtractImagePatches(const Output< Node > &image, const Shape &sizes, const Strides &strides, const Shape &rates, const PadType &auto_pad)
Constructs a ExtractImagePatches operation.
ngraph::op::Op
Root of all actual ops.
Definition: op.hpp:29