xor.hpp
1 //*****************************************************************************
2 // Copyright 2017-2020 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/op/util/binary_elementwise_logical.hpp"
22 
23 namespace ngraph
24 {
25  namespace op
26  {
27  namespace v1
28  {
29  /// \brief Elementwise logical-xor operation.
30  ///
31  class NGRAPH_API LogicalXor : public util::BinaryElementwiseLogical
32  {
33  public:
34  NGRAPH_RTTI_DECLARATION;
35  LogicalXor() = default;
36  /// \brief Constructs a logical-xor operation.
37  ///
38  /// \param arg0 Node that produces the first input tensor.<br>
39  /// `[d0, ...]`
40  /// \param arg1 Node that produces the second input tensor.<br>
41  /// `[d0, ...]`
42  /// \param auto_broadcast Auto broadcast specification
43  ///
44  /// Output `[d0, ...]`
45  ///
46  LogicalXor(const Output<Node>& arg0,
47  const Output<Node>& arg1,
48  const AutoBroadcastSpec& auto_broadcast =
49  AutoBroadcastSpec(AutoBroadcastType::NUMPY));
50 
51  virtual std::shared_ptr<Node>
52  clone_with_new_inputs(const OutputVector& new_args) const override;
53 
54  bool visit_attributes(AttributeVisitor& visitor) override;
55  bool evaluate(const HostTensorVector& outputs,
56  const HostTensorVector& inputs) const override;
57  };
58  } // namespace v1
59  namespace v0
60  {
61  /// \brief Elementwise logical-xor operation.
62  ///
63  class NGRAPH_API Xor : public util::BinaryElementwiseLogical
64  {
65  public:
66  static constexpr NodeTypeInfo type_info{"Xor", 0};
67  const NodeTypeInfo& get_type_info() const override { return type_info; }
68  Xor() = default;
69  /// \brief Constructs a logical-xor operation.
70  ///
71  /// \param arg0 Node that produces the first input tensor.<br>
72  /// `[d0, ...]`
73  /// \param arg1 Node that produces the second input tensor.<br>
74  /// `[d0, ...]`
75  /// \param auto_broadcast Auto broadcast specification
76  ///
77  /// Output `[d0, ...]`
78  ///
79  Xor(const Output<Node>& arg0,
80  const Output<Node>& arg1,
81  const AutoBroadcastSpec& auto_broadcast = AutoBroadcastSpec());
82 
83  virtual std::shared_ptr<Node>
84  clone_with_new_inputs(const OutputVector& new_args) const override;
85 
86  bool evaluate(const HostTensorVector& outputs,
87  const HostTensorVector& inputs) const override;
88  };
89  } // namespace v0
90 
91  // default opset version
92  using v0::Xor;
93  } // namespace op
94 } // namespace ngraph
ngraph::op::v1::LogicalXor
Elementwise logical-xor operation.
Definition: xor.hpp:32
ngraph::op::AutoBroadcastSpec
Implicit broadcast specification.
Definition: attr_types.hpp:321
ngraph::op::util::BinaryElementwiseLogical
Abstract base class for elementwise binary logical operations, i.e., operations where the same scalar...
Definition: binary_elementwise_logical.hpp:54
ngraph::op::v0::Xor
Elementwise logical-xor operation.
Definition: xor.hpp:64
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::op::v0::Xor::get_type_info
const NodeTypeInfo & get_type_info() const override
Definition: xor.hpp:67
ngraph::AttributeVisitor
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:70
ngraph::op::v0::Xor::Xor
Xor(const Output< Node > &arg0, const Output< Node > &arg1, const AutoBroadcastSpec &auto_broadcast=AutoBroadcastSpec())
Constructs a logical-xor operation.
ngraph::op::v1::LogicalXor::LogicalXor
LogicalXor(const Output< Node > &arg0, const Output< Node > &arg1, const AutoBroadcastSpec &auto_broadcast=AutoBroadcastSpec(AutoBroadcastType::NUMPY))
Constructs a logical-xor operation.