xor.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <memory>
8 
9 #include "ngraph/op/util/binary_elementwise_logical.hpp"
10 
11 namespace ngraph
12 {
13  namespace op
14  {
15  namespace v1
16  {
17  /// \brief Elementwise logical-xor operation.
18  ///
19  class NGRAPH_API LogicalXor : public util::BinaryElementwiseLogical
20  {
21  public:
22  NGRAPH_RTTI_DECLARATION;
23  LogicalXor() = default;
24  /// \brief Constructs a logical-xor operation.
25  ///
26  /// \param arg0 Node that produces the first input tensor.<br>
27  /// `[d0, ...]`
28  /// \param arg1 Node that produces the second input tensor.<br>
29  /// `[d0, ...]`
30  /// \param auto_broadcast Auto broadcast specification
31  ///
32  /// Output `[d0, ...]`
33  ///
34  LogicalXor(const Output<Node>& arg0,
35  const Output<Node>& arg1,
36  const AutoBroadcastSpec& auto_broadcast =
37  AutoBroadcastSpec(AutoBroadcastType::NUMPY));
38 
39  virtual std::shared_ptr<Node>
40  clone_with_new_inputs(const OutputVector& new_args) const override;
41 
42  bool visit_attributes(AttributeVisitor& visitor) override;
43  bool evaluate(const HostTensorVector& outputs,
44  const HostTensorVector& inputs) const override;
45  bool has_evaluate() const override;
46  };
47  } // namespace v1
48  namespace v0
49  {
50  /// \brief Elementwise logical-xor operation.
51  ///
52  class NGRAPH_API Xor : public util::BinaryElementwiseLogical
53  {
54  public:
55  static constexpr NodeTypeInfo type_info{"Xor", 0};
56  const NodeTypeInfo& get_type_info() const override { return type_info; }
57  Xor() = default;
58  /// \brief Constructs a logical-xor operation.
59  ///
60  /// \param arg0 Node that produces the first input tensor.<br>
61  /// `[d0, ...]`
62  /// \param arg1 Node that produces the second input tensor.<br>
63  /// `[d0, ...]`
64  /// \param auto_broadcast Auto broadcast specification
65  ///
66  /// Output `[d0, ...]`
67  ///
68  Xor(const Output<Node>& arg0,
69  const Output<Node>& arg1,
70  const AutoBroadcastSpec& auto_broadcast = AutoBroadcastSpec());
71 
72  virtual std::shared_ptr<Node>
73  clone_with_new_inputs(const OutputVector& new_args) const override;
74 
75  bool evaluate(const HostTensorVector& outputs,
76  const HostTensorVector& inputs) const override;
77  bool has_evaluate() const override;
78  };
79  } // namespace v0
80 
81  // default opset version
82  using v0::Xor;
83  } // namespace op
84 } // 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
Abstract base class for elementwise binary logical operations, i.e., operations where the same scalar...
Definition: binary_elementwise_logical.hpp:42
Elementwise logical-xor operation.
Definition: xor.hpp:53
bool has_evaluate() const override
Allows to get information about availability of evaluate method for the current operation.
const NodeTypeInfo & get_type_info() const override
Definition: xor.hpp:56
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
Xor(const Output< Node > &arg0, const Output< Node > &arg1, const AutoBroadcastSpec &auto_broadcast=AutoBroadcastSpec())
Constructs a logical-xor operation.
Elementwise logical-xor operation.
Definition: xor.hpp:20
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
LogicalXor(const Output< Node > &arg0, const Output< Node > &arg1, const AutoBroadcastSpec &auto_broadcast=AutoBroadcastSpec(AutoBroadcastType::NUMPY))
Constructs a logical-xor 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
Definition: type.hpp:27
Implicit broadcast specification.
Definition: attr_types.hpp:311