roll.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include "ngraph/node.hpp"
8 #include "ngraph/op/op.hpp"
9 
10 namespace ngraph
11 {
12  namespace op
13  {
14  namespace v7
15  {
16  /// \brief Tensor roll operation.
17  class NGRAPH_API Roll : public Op
18  {
19  public:
20  NGRAPH_RTTI_DECLARATION;
21 
22  Roll() = default;
23 
24  ///
25  /// \brief Constructs a roll operation.
26  ///
27  /// \param data Node producing the tensor to be shifted.
28  /// \param shift Node producing the 0D or 1D tensor which specifies the
29  /// number of places by which the elements are shifted.
30  /// \param axes Node producing the 0D or 1D tensor which specifies axes
31  /// along which elements are shifted.
32  ///
33  Roll(const Output<Node>& data, const Output<Node>& shift, const Output<Node>& axes);
34 
35  void validate_and_infer_types() override;
36 
37  bool visit_attributes(AttributeVisitor& visitor) override;
38 
39  std::shared_ptr<Node>
40  clone_with_new_inputs(const OutputVector& new_args) const override;
41  };
42  } // namespace v7
43  } // namespace op
44 } // 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
Tensor roll operation.
Definition: roll.hpp:18
Roll(const Output< Node > &data, const Output< Node > &shift, const Output< Node > &axes)
Constructs a roll operation.
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