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