transpose.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include "ngraph/axis_vector.hpp"
8 #include "ngraph/node.hpp"
9 #include "ngraph/op/op.hpp"
10 
11 namespace ngraph
12 {
13  namespace op
14  {
15  namespace v1
16  {
17  /// \brief Tensor transpose operation.
18  class NGRAPH_API Transpose : public Op
19  {
20  public:
21  NGRAPH_RTTI_DECLARATION;
22 
23  Transpose() = default;
24  ///
25  /// \brief Constructs a transpose operation.
26  ///
27  /// \param arg Node producing the tensor to be transposed.
28  /// \param input_order Node producing the permutation to apply to the axes
29  /// of the input shape. Must be a vector with shape [n],
30  /// where n is the rank of arg. The tensor's value must
31  /// contain every integer in the range [0, n-1].
32  ///
33  Transpose(const Output<Node>& arg, const Output<Node>& input_order);
34 
35  bool visit_attributes(AttributeVisitor& visitor) override;
36  void validate_and_infer_types() override;
37 
38  virtual std::shared_ptr<Node>
39  clone_with_new_inputs(const OutputVector& new_args) const override;
40 
41  bool evaluate(const HostTensorVector& outputs,
42  const HostTensorVector& inputs) const override;
43  bool has_evaluate() const override;
44  };
45  } // namespace v1
46  using v1::Transpose;
47  } // namespace op
48 } // 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 transpose operation.
Definition: transpose.hpp:19
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
Transpose(const Output< Node > &arg, const Output< Node > &input_order)
Constructs a transpose operation.
bool has_evaluate() const override
Allows to get information about availability of evaluate method for the current operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16