convert_like.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include "ngraph/op/op.hpp"
8 
9 namespace ngraph
10 {
11  namespace op
12  {
13  namespace v1
14  {
15  /// \brief Elementwise type conversion operation.
16  class NGRAPH_API ConvertLike : public Op
17  {
18  public:
19  static constexpr NodeTypeInfo type_info{"ConvertLike", 1};
20  const NodeTypeInfo& get_type_info() const override { return type_info; }
21  /// \brief Constructs a conversion operation.
22  ConvertLike() = default;
23  /// \brief Constructs a conversion operation.
24  /// \param data Node that produces the input tensor.
25  /// \param like Node which provides the target type information for the conversion.
26  ConvertLike(const Output<Node>& data, const Output<Node>& like);
27 
28  void validate_and_infer_types() override;
29  bool visit_attributes(AttributeVisitor& visitor) override;
30 
31  virtual std::shared_ptr<Node>
32  clone_with_new_inputs(const OutputVector& new_args) const override;
33 
34  bool constant_fold(OutputVector& output_values,
35  const OutputVector& input_values) override;
36  };
37 
38  } // namespace v1
39 
40  } // namespace op
41 
42 } // 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
Elementwise type conversion operation.
Definition: convert_like.hpp:17
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:20
ConvertLike()=default
Constructs a conversion operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27