scatter_base.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 util
14  {
15  ///
16  /// \brief Base class for ScatterXXX operators.
17  ///
18  class NGRAPH_API ScatterBase : public Op
19  {
20  public:
21  static constexpr NodeTypeInfo type_info{"ScatterBase", 3};
22  const NodeTypeInfo& get_type_info() const override { return type_info; }
23  virtual void validate_and_infer_types() override;
24  virtual bool visit_attributes(AttributeVisitor& visitor) override;
25 
26  protected:
27  ScatterBase() = default;
28 
29  ///
30  /// \brief Constructs ScatterBase object.
31  ///
32  /// \param inputs The input tensor to be updated.
33  /// \param indices The tensor with indexes which will be updated.
34  /// \param updates The tensor with update values.
35  /// \param[in] axis The axis at which elements will be updated.
36  ///
37  ScatterBase(const Output<Node>& inputs,
38  const Output<Node>& indices,
39  const Output<Node>& updates,
40  const Output<Node>& axis);
41 
42  private:
43  // Respective input ordinal number.
44  static constexpr int DATA = 0;
45  static constexpr int INDICES = 1;
46  static constexpr int UPDATES = 2;
47  static constexpr int AXIS = 3;
48  };
49  } // namespace util
50  } // namespace op
51 } // 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
Base class for ScatterXXX operators.
Definition: scatter_base.hpp:19
ScatterBase(const Output< Node > &inputs, const Output< Node > &indices, const Output< Node > &updates, const Output< Node > &axis)
Constructs ScatterBase object.
const NodeTypeInfo & get_type_info() const override
Definition: scatter_base.hpp:22
virtual void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27