equal.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/util/binary_elementwise_comparison.hpp"
20 
21 namespace ngraph
22 {
23  namespace op
24  {
25  namespace v1
26  {
27  // clang-format off
28  /// \brief Elementwise is-equal operation.
29  ///
30  /// ## Inputs
31  ///
32  /// | | Type | Description |
33  /// | ------ | --------------------------------- | ------------------------------------------------------ |
34  /// | `arg0` | \f$E[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of any shape and element type. |
35  /// | `arg1` | \f$E[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of the same shape and element type as `arg0`. |
36  /// | `autob`| AutoBroadcastSpec | Auto broadcast specification. |
37  ///
38  /// ## Output
39  ///
40  /// | Type | Description |
41  /// | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
42  /// | \f$\texttt{bool}[d_1,\dots,d_n]\f$ | The tensor \f$T\f$, where \f$T[i_1,\dots,i_n] = 1\text{ if }\texttt{arg0}[i_1,\dots,i_n] = \texttt{arg1}[i_1,\dots,i_n]\text{, else } 0\f$ |
43  // clang-format on
44  class NGRAPH_API Equal : public util::BinaryElementwiseComparison
45  {
46  public:
47  NGRAPH_RTTI_DECLARATION;
48  /// \brief Constructs an equal operation.
50  : util::BinaryElementwiseComparison(AutoBroadcastSpec::NUMPY)
51  {
52  }
53  /// \brief Constructs an equal operation.
54  ///
55  /// \param arg0 Node that produces the first input tensor.
56  /// \param arg1 Node that produces the second input tensor.
57  /// \param auto_broadcast Auto broadcast specification
58  Equal(const Output<Node>& arg0,
59  const Output<Node>& arg1,
60  const AutoBroadcastSpec& auto_broadcast =
61  AutoBroadcastSpec(AutoBroadcastType::NUMPY));
62 
63  bool visit_attributes(AttributeVisitor& visitor) override;
64  virtual std::shared_ptr<Node>
65  clone_with_new_inputs(const OutputVector& new_args) const override;
66 
67  bool evaluate(const HostTensorVector& outputs,
68  const HostTensorVector& inputs) const override;
69  };
70  } // namespace v1
71  }
72 }
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
Abstract base class for elementwise binary comparison operations, i.e., operations where the same sca...
Definition: binary_elementwise_comparison.hpp:55
Elementwise is-equal operation.
Definition: equal.hpp:45
Equal()
Constructs an equal operation.
Definition: equal.hpp:49
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
Equal(const Output< Node > &arg0, const Output< Node > &arg1, const AutoBroadcastSpec &auto_broadcast=AutoBroadcastSpec(AutoBroadcastType::NUMPY))
Constructs an equal operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
Implicit broadcast specification.
Definition: attr_types.hpp:323