unsqueeze.hpp
1 //*****************************************************************************
2 // Copyright 2017-2021 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 <memory>
20 
21 #include "ngraph/axis_vector.hpp"
22 #include "ngraph/node.hpp"
23 #include "ngraph/op/op.hpp"
24 
25 namespace ngraph
26 {
27  namespace op
28  {
29  namespace v0
30  {
31  class NGRAPH_API Unsqueeze : public Op
32  {
33  public:
34  NGRAPH_RTTI_DECLARATION;
35 
36  Unsqueeze() = default;
37  Unsqueeze(const Output<Node>& data, const Output<Node>& axes);
38 
39  void validate_and_infer_types() override;
40  bool visit_attributes(AttributeVisitor& visitor) override;
41  bool evaluate(const HostTensorVector& outputs,
42  const HostTensorVector& inputs) const override;
43  bool evaluate_lower(const HostTensorVector& output_values) const override;
44  bool evaluate_upper(const HostTensorVector& output_values) const override;
45 
46  bool constant_fold(OutputVector& output_values,
47  const OutputVector& inputs_values) override;
48 
49  virtual std::shared_ptr<Node>
50  clone_with_new_inputs(const OutputVector& new_args) const override;
51  };
52  }
53  using v0::Unsqueeze;
54  }
55 }
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:71
A handle for one of a node's outputs.
Definition: node_output.hpp:42
Root of all actual ops.
Definition: op.hpp:29
Definition: unsqueeze.hpp:32
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
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:28