convert_like.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 "ngraph/op/op.hpp"
20 
21 namespace ngraph
22 {
23  namespace op
24  {
25  namespace v1
26  {
27  /// \brief Elementwise type conversion operation.
28  class NGRAPH_API ConvertLike : public Op
29  {
30  public:
31  static constexpr NodeTypeInfo type_info{"ConvertLike", 1};
32  const NodeTypeInfo& get_type_info() const override { return type_info; }
33  /// \brief Constructs a conversion operation.
34  ConvertLike() = default;
35  /// \brief Constructs a conversion operation.
36  /// \param data Node that produces the input tensor.
37  /// \param like Node which provides the target type information for the conversion.
38  ConvertLike(const Output<Node>& data, const Output<Node>& like);
39 
40  void validate_and_infer_types() override;
41  bool visit_attributes(AttributeVisitor& visitor) override;
42 
43  virtual std::shared_ptr<Node>
44  clone_with_new_inputs(const OutputVector& new_args) const override;
45 
46  bool constant_fold(OutputVector& output_values,
47  const OutputVector& input_values) override;
48  };
49 
50  } // namespace v1
51 
52  } // namespace op
53 
54 } // namespace ngraph
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
Elementwise type conversion operation.
Definition: convert_like.hpp:29
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
ConvertLike(const Output< Node > &data, const Output< Node > &like)
Constructs a conversion operation.
const NodeTypeInfo & get_type_info() const override
Definition: convert_like.hpp:32
ConvertLike()=default
Constructs a conversion operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
Definition: type.hpp:39