scatter_update.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 #include "ngraph/op/util/scatter_base.hpp"
9 #include "ngraph/runtime/host_tensor.hpp"
10 
11 namespace ngraph
12 {
13  namespace op
14  {
15  namespace v3
16  {
17  ///
18  /// \brief Set new values to slices from data addressed by indices
19  ///
20  class NGRAPH_API ScatterUpdate : public util::ScatterBase
21  {
22  public:
23  static constexpr NodeTypeInfo type_info{"ScatterUpdate", 3};
24  const NodeTypeInfo& get_type_info() const override { return type_info; }
25  ScatterUpdate() = default;
26  ///
27  /// \brief Constructs ScatterUpdate operator object.
28  ///
29  /// \param data The input tensor to be updated.
30  /// \param indices The tensor with indexes which will be updated.
31  /// \param updates The tensor with update values.
32  /// \param[in] axis The axis at which elements will be updated.
33  ///
35  const Output<Node>& indices,
36  const Output<Node>& updates,
37  const Output<Node>& axis);
38 
39  virtual std::shared_ptr<Node>
40  clone_with_new_inputs(const OutputVector& inputs) const override;
41 
42  bool evaluate(const HostTensorVector& outputs,
43  const HostTensorVector& inputs) const override;
44  bool has_evaluate() const override;
45 
46  private:
47  bool evaluate_scatter_update(const HostTensorVector& outputs,
48  const HostTensorVector& inputs) const;
49  };
50  } // namespace v3
51  } // namespace op
52 } // namespace ngraph
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Base class for ScatterXXX operators.
Definition: scatter_base.hpp:19
Set new values to slices from data addressed by indices.
Definition: scatter_update.hpp:21
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
bool has_evaluate() const override
Allows to get information about availability of evaluate method for the current operation.
const NodeTypeInfo & get_type_info() const override
Definition: scatter_update.hpp:24
ScatterUpdate(const Output< Node > &data, const Output< Node > &indices, const Output< Node > &updates, const Output< Node > &axis)
Constructs ScatterUpdate operator object.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27