scatter_elements_update.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/axis_vector.hpp"
20 #include "ngraph/node.hpp"
21 #include "ngraph/op/op.hpp"
22 #include "ngraph/runtime/aligned_buffer.hpp"
23 #include "ngraph/runtime/host_tensor.hpp"
24 
25 namespace ngraph
26 {
27  namespace op
28  {
29  namespace v3
30  {
31  class NGRAPH_API ScatterElementsUpdate : public Op
32  {
33  public:
34  static constexpr NodeTypeInfo type_info{"ScatterElementsUpdate", 3};
35  const NodeTypeInfo& get_type_info() const override { return type_info; }
36  ScatterElementsUpdate() = default;
37  /// \brief Constructs a ScatterElementsUpdate node
38 
39  /// \param data Input data
40  /// \param indices Data entry index that will be updated
41  /// \param updates Update values
42  /// \param axis Axis to scatter on
44  const Output<Node>& indices,
45  const Output<Node>& updates,
46  const Output<Node>& axis);
47 
48  virtual void validate_and_infer_types() override;
49  virtual bool visit_attributes(AttributeVisitor& visitor) override;
50 
51  virtual std::shared_ptr<Node>
52  clone_with_new_inputs(const OutputVector& inputs) const override;
53  bool evaluate(const HostTensorVector& outputs,
54  const HostTensorVector& inputs) const override;
55 
56  private:
57  bool evaluate_scatter_element_update(const HostTensorVector& outputs,
58  const HostTensorVector& inputs) const;
59  };
60  }
62  }
63 }
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
Root of all actual ops.
Definition: op.hpp:29
Definition: scatter_elements_update.hpp:32
virtual void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
const NodeTypeInfo & get_type_info() const override
Definition: scatter_elements_update.hpp:35
ScatterElementsUpdate(const Output< Node > &data, const Output< Node > &indices, const Output< Node > &updates, const Output< Node > &axis)
Constructs a ScatterElementsUpdate node.
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
Definition: type.hpp:39